﻿BoBO:

; ################# 辅助增强 #################
		 ^!c::obsidian_New("BoBOStudio","99_临时/")
		 ^!a::
		 	GV_KeyClickAction1 := "Gosub,<FSCapture_矩形区域>"
			GV_KeyClickAction2 := "Gosub,menuFSCapture"
			GoSub,Sub_KeyClick
			return
	;显示实快捷键提示
		LAlt & 1::
			{
				GV_KeyClickAction1 := "goSub,Run_ShortCutHelperExe"
				GV_keyClickAction2 := "goSub,Run_Espanso"
				GoSub,Sub_KeyClick
				return
			}
	;切换显示器
		; # & Lbutton::
		#+j::send,#+{left}
			; sleep,200
		#+k:: send #+{right}
	; 命令行s
		#h::run,cmd
		^#h::run,*RunAs cmd
 	;按住Win加滚轮来调整音量大小
 		LWin & WheelUp::Send,{Volume_Up}
 		LWin & WheelDown::Send,{Volume_Down}
	;按住Win+C打开默认资源管理器，按Win+c+c关闭其它管理器	
		LWin & c::
			GV_KeyClickAction1 := "Gosub,Run_Explore"
			GV_KeyClickAction2 := "Gosub,Run_ExploreCls"
			GoSub,Sub_KeyClick
		return
		LWin & x::
			GV_KeyClickAction1 := "send,#{x}"
			GV_KeyClickAction2 := "Gosub,Run_ClsClose"
			GoSub,Sub_KeyClick
		return
	; 搜索?????
		; /::
		; 	GV_KeyClickAction1 := "send,{/}"
		; 	GV_KeyClickAction2 := "Gosub,menuBase"
		; 	GoSub,Sub_KeyClick
		; return
		^!q::Gosub,mSmartProcess
		; LWin & q::Gosub,mSmartProcess
		; #/::Gosub,menuBase
	; ;显示 复制和剪切的内容//
		; ~^x::
		~^c::		;~ 表示次热键并不屏蔽按键原有功能
			GV_KeyClickAction1 := "Gosub,CopyTip"
			GV_KeyClickAction2 := "Gosub,menuBase"
			GoSub,Sub_KeyClick
		Return
		CopyTip:
			send,^{c}
			Sleep, 100	;等待0.1s 强制机械等待剪贴板出现内容 
			StringLeft,clipboard_left,clipboard,500
			ToolTip 已复制：%clipboard_left%
			SetTimer, ToolTipOff, -1000
		return
		; 切换临近打开2个窗口
		LWin & q::Gosub,SwitchWindows
		return

	;功能：关闭(Alt + x)
		!x::send, ^w
	;功能：最小化窗口
		~Alt & `::
		~LButton & `::WinMinimize, A ;窗口最小化
	;功能：快捷键获取当前选中文件路径
		; ^!c:: Gosub,menuBase
		; 	send ^c
		; 	sleep,200
		; 	clipboard=%clipboard% ;windows 复制的时候，剪贴板保存的是“路径”。只是路径不是字符串，只要转换成字符串就可以粘贴出来了
		; 	tooltip,已经拷贝%clipboard% ;提示文本
		; 	sleep,500
		; 	tooltip,
		; return
	;功能：字母跳转
		; #q::
		; SendInput,^!{q}
		; return
	;功能：清空回车
		#Del::FileRecycleEmpty ; win + del
	;功能：字母定位	
		#w::
		Gosub,<BoBO_HuntAndPeck>
		return
		; # & Alt::SendInput,^!{q}
	;功能：快速打开浏览器
		#g::Send,#{2}
	;功能：软件启动器(热键：Win+右键	)
		#z::PopSel("")
		; F1::PopSel("")
		; 	GV_KeyClickAction1 := "PopSel("")"
		; 	GV_KeyClickAction2 := "GoSub,SmartProcess"
		; 	GoSub,Sub_KeyClick
		; return
		#RButton::PopSel("")
	;功能：启动记事本并去标题等
		#n::
			run, %A_ScriptDir%\tools\TotalCMD\Tools\Notepad\Notepad.exe /b /f %A_ScriptDir%\tools\TotalCMD\Tools\Notepad\Notepad.ini, , , OutputVarPID
			sleep 100
			WinWait ahk_pid %OutputVarPID%
			if ErrorLevel
			{
				toolTip 超时了，再试一下？
				sleep 2000
				tooltip
				return
			}
		return
		;功能：窗口居中(热键：Win+Z或鼠标点击按 Z 键)
		^#z::Gosub,<BoBO_CenterWindow>
		;窗口居中
		~LButton & z:: 
			WinGet, activePath, ProcessPath, % "ahk_id" winActive("A")
			tool_pathandname = "%activePath%"
			KeyWait, LButton
			Gosub,<BoBO_CenterWindow>
		return


	;功能：窗口置顶
		#MButton::
		WinSet, AlwaysOnTop, toggle,A
		WinGetTitle, getTitle, A
		Winget, getTop,ExStyle,A
		if (getTop & 0x8)
		{
			toolTip,"已置顶"
			SetTimer, RemoveToolTip, -500
			return
		}

		else
		{
			toolTip,"取消置顶"
			SetTimer, RemoveToolTip, -500
			return
		}
		return
	;功能：任务栏切换
		!Tab::Gosub,<BoBO_TaskSwch>

	;功能：关闭所有资源管理器窗口
		^#x::
			GroupAdd, Explore, ahk_class CabinetWClass
			GroupClose, Explore, A
		return

	;功能：Shift切换任务栏(原始)
		; LShift & WheelDown::AltTab
		; LShift & WheelUp::ShiftAltTab

	;功能：打开程序所在位置
		;Ctrl+Alt+点击，定位程序对应的目录 打开当前程序所在位置
		^!LButton::Gosub,<opemLocalDirExe>
	; ;功能：双击关闭显示器
	; 	Home::
	; 		GV_KeyClickAction1 := "SendInput,{Home}"
	; 		GV_KeyClickAction2 := "GoSub,CloseScreen"
	; 		GoSub,Sub_KeyClick
	; 	return
		CloseScreen:
		{
			; Sleep 1000
			; SendMessage, 0x112, 0xF170, 2,, Program Manager	
			Run,%A_ScriptDir%\custom\apps\ScrnOff.EXE *911
			return
			; msgbox*****
		}
	;功能：快速打开驱动盘(热键：Tab + 左键	)
		Tab & LButton::Gosub,<BoBO_SubFolder>
		<BoBO_SubFolder>:
		{
			run %A_ScriptDir%\custom\apps\SubFolder\SubFolder.EXE フォルダー名 /-(AD) /-N /-R /-S /-H /-L /-M /-Y /-R /+E [/.TXT.DLL] [*.TXT]
			return 
		}
	;LShift+鼠标滚轮调整窗口透明度（设置30-255的透明度，低于30基本上就看不见了，如需要可自行修改）
		~LShift & WheelUp::
		; 透明度调整，增加。
			WinGet, Transparent, Transparent,A
			If (Transparent="")
				Transparent=255
				;Transparent_New:=Transparent+10
			Transparent_New:=Transparent+20    ;◆透明度增加速度。
			If (Transparent_New > 254)
				Transparent_New =255
			WinSet,Transparent,%Transparent_New%,A

			tooltip 原透明度: %Transparent_New% `n新透明度: %Transparent%
			;查看当前透明度（操作之后的）。
			SetTimer, RemoveToolTip_transparent_Lwin, 1500
		return

		~LShift & WheelDown::
			;透明度调整，减少。
			WinGet, Transparent, Transparent,A
			If (Transparent="")
				Transparent=255
			Transparent_New:=Transparent-10  ;◆透明度减少速度。
			;msgbox,Transparent_New=%Transparent_New%
			If (Transparent_New < 30)    ;◆最小透明度限制。ddd的
				Transparent_New = 30
			WinSet,Transparent,%Transparent_New%,A
			tooltip 原透明度: %Transparent_New% `n新透明度: %Transparent%
			SetTimer, RemoveToolTip_transparent_Lwin, 1500
		return
		!z::
			Value:=WindowList[WindowList.Length()-1]
			IfWinNotExist,ahk_id  %Value%
			{
				WindowList.RemoveAt(WindowList.Length()-1)
			}
			
			WinActivate,ahk_id  %Value%
			
			return

	;功能：任务栏
		; #q::Gosub,showTim
	;功能：窗口设置****************************
		; !Enter:: GoSub,Sub_MaxAllRestore
		^!#up:: GoSub,Sub_MaxAllWindows
		CapsLock & Enter:: GoSub,Sub_MaxRestore
		CapsLock & Space:: WinMinimize A

		#Enter:: GoSub,Sub_MaxAllRestore
		Pause:: GoSub,Sub_MaxAllRestore

		; LShift & MButton::GoSub,Sub_MaxRestore
		LWin & LButton::
			GV_KeyClickAction1 := "GoSub,Sub_MaxRestore"
			GV_KeyClickAction2 := "send,#+{left}"
			GoSub,Sub_KeyClick
		return
		<#^LButton::send,#+{left}

	;按住caps加左键拖动窗口
			Capslock & LButton::
			Escape & LButton::
				CoordMode, Mouse  ; Switch to screen/absolute coordinates.
				MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
				WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
				WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 
				if EWD_WinState = 0  ; Only if the window isn't maximized 
					SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
			return

			EWD_WatchMouse:
				GetKeyState, EWD_LButtonState, LButton, P
				if EWD_LButtonState = U  ; Button has been released, so drag is complete.
				{
					SetTimer, EWD_WatchMouse, off
					return
				}
				;GetKeyState, EWD_EscapeState, Escape, P
				;if EWD_EscapeState = D  ; Escape has been pressed, so drag is cancelled.
				;{
				;	SetTimer, EWD_WatchMouse, off
				;	WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
				;	return
				;}
				; Otherwise, reposition the window to match the change in mouse coordinates
				; caused by the user having dragged the mouse:
				CoordMode, Mouse
				MouseGetPos, EWD_MouseX, EWD_MouseY
				WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
				SetWinDelay, -1   ; Makes the below move faster/smoother.
				WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
				EWD_MouseStartX := EWD_MouseX  ; Update for the next timer-call to this subroutine.
				EWD_MouseStartY := EWD_MouseY
			return

	;按住caps加右键放大和缩小窗口
			; Capslock & RButton::
			Escape & RButton::
				CoordMode, Mouse, Screen ; Switch to screen/absolute coordinates.
				MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
				WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY, EWD_WinWidth, EWD_WinHeight, ahk_id %EWD_MouseWin%
				EWD_StartPosX := EWD_WinWidth - EWD_MouseStartX
				EWD_StartPosY := EWD_WinHeight - EWD_MouseStartY
				
				WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 
				if EWD_WinState = 0  ; Only if the window isn't maximized 
					SetTimer, EWD_ResizeWindow, 10 ; Track the mouse as the user drags it.
			Return
			EWD_ResizeWindow:
				If Not GetKeyState("RButton", "P"){
					SetTimer, EWD_ResizeWindow, off
					Return
				}
				CoordMode, Mouse, Screen ; Switch to screen/absolute coordinates.
				MouseGetPos, EWD_MouseX, EWD_MouseY
				SetWinDelay, -1   ; Makes the below move faster/smoother.
				WinMove, ahk_id %EWD_MouseWin%,, EWD_OriginalPosX, EWD_OriginalPosY, EWD_StartPosX + EWD_MouseX, EWD_StartPosY + EWD_MouseY
			Return
	;在任意窗口实现水平滚动的程序HorizontalScroll
			; +WheelUp::  ; Scroll left.
			; 	SetTitleMatchMode, 2
			; 	IfWinActive, Microsoft Excel -
			; 	{
			; 		;SetScrollLockState, on
			; 		ComObjActive("Excel.Application").ActiveWindow.SmallScroll(0,0,0,2)
			; 		;SetScrollLockState, off
			; 	}
			; 	else IfWinActive, PowerPoint
			; 		ComObjActive("PowerPoint.Application").ActiveWindow.SmallScroll(0,0,0,3)
			; 	else IfWinActive, Adobe Acrobat Professional -
			; 	{
			; 		send,+{left}
			; 	}
			; 	else IfWinActive, - Mozilla Firefox
			; 	{
			; 		Loop 4
			; 			send,{left}
			; 	}
			; 	else
			; 	{
			; 		ControlGetFocus, FocusedControl, A
			; 		Loop 10
			; 			SendMessage, 0x114, 0, 0, %FocusedControl%, A  ; 0x114 is WM_HSCROLL ; 1 vs. 0 causes SB_LINEDOWN vs. UP
			; 	}
			; return

			; +WheelDown::  ; Scroll right.
			; 	SetTitleMatchMode, 2
			; 	IfWinActive, Microsoft Excel -
			; 	{
			; 		;SetScrollLockState, on
			; 		ComObjActive("Excel.Application").ActiveWindow.SmallScroll(0,0,2,0)
			; 		;SetScrollLockState, off
			; 	}
			; 	else IfWinActive, PowerPoint
			; 		ComObjActive("PowerPoint.Application").ActiveWindow.SmallScroll(0,0,3,0)
			; 	else IfWinActive, Adobe Acrobat Professional -
			; 	{
			; 		send,+{right}
			; 	}
			; 	else IfWinActive, - Mozilla Firefox
			; 	{
			; 		Loop 4
			; 			send,{right}
			; 	}
			; 	else
			; 	{
			; 		ControlGetFocus, FocusedControl, A
			; 		Loop 10
			; 			SendMessage, 0x114, 1, 0, %FocusedControl%, A  ; 0x114 is WM_HSCROLL ; 1 vs. 0 causes SB_LINEDOWN vs. UP
			; 	}
			; return

			; ^+WheelUp::  ; Scroll left.
			; 	SetTitleMatchMode, 2
			; 	IfWinActive, Microsoft Excel -
			; 	{
			; 		;SetScrollLockState, on
			; 		ComObjActive("Excel.Application").ActiveWindow.SmallScroll(0,0,0,10)
			; 		;SetScrollLockState, off
			; 	}
			; 	else IfWinActive, PowerPoint
			; 		ComObjActive("PowerPoint.Application").ActiveWindow.SmallScroll(0,0,0,10)
			; 	else IfWinActive, Adobe Acrobat Professional -
			; 	{
			; 		send,+{left}
			; 	}
			; 	else IfWinActive, - Mozilla Firefox
			; 	{
			; 		Loop 4
			; 			send,{left}
			; 	}
			; 	else
			; 	{
			; 		ControlGetFocus, FocusedControl, A
			; 		Loop 500
			; 			SendMessage, 0x114, 0, 0, %FocusedControl%, A  ; 0x114 is WM_HSCROLL ; 1 vs. 0 causes SB_LINEDOWN vs. UP ; ZHULAOJIANKEHAVEWRITTENITONAPRIL THETENTH INTWENTYTWENTYONE
			; 	}
			; return

			; ^+WheelDown::  ; Scroll right.
			; 	SetTitleMatchMode, 2
			; 	IfWinActive, Microsoft Excel -
			; 	{
			; 		;SetScrollLockState, on
			; 		ComObjActive("Excel.Application").ActiveWindow.SmallScroll(0,0,10,0)
			; 		;SetScrollLockState, off
			; 	}
			; 	else IfWinActive, PowerPoint
			; 		ComObjActive("PowerPoint.Application").ActiveWindow.SmallScroll(0,0,10,0)
			; 	else IfWinActive, Adobe Acrobat Professional -
			; 	{
			; 		send,+{right}
			; 	}
			; 	else IfWinActive, - Mozilla Firefox
			; 	{
			; 		Loop 4
			; 			send,{right}
			; 	}
			; 	else
			; 	{
			; 		ControlGetFocus, FocusedControl, A
			; 		Loop 100
			; 			SendMessage, 0x114, 1, 0, %FocusedControl%, A  ; 0x114 is WM_HSCROLL ; 1 vs. 0 causes SB_LINEDOWN vs. UP
			; 	}
			; return
; ################# ` 相关 ################
	; `剪贴复制粘贴删除
	` & 1:: SendInput,^x
	` & 2:: SendInput,^c
	` & 3:: SendInput,^v
	` & 4:: SendInput,{Del}
	` & `;:: SendInput,{Blind}{Home}+{End}

	` & j:: SendInput,{Blind}+{Down}
	` & k:: SendInput,{Blind}+{Up}
	` & h:: SendInput,{Blind}+{Left}
	` & l:: SendInput,{Blind}+{Right}

	` & b:: SendInput,{Blind}^+{Left}
	` & w:: SendInput,{Blind}^+{Right}

	` & n:: SendInput,{Blind}+{PgDn}
	` & m:: SendInput,{Blind}+{PgUp}

	` & u::
		GV_KeyClickAction1 := "SendInput,+{End}"
		GV_KeyClickAction2 := "SendInput,^+{End}"
		GoSub,Sub_KeyClick
	return

	` & i::
		GV_KeyClickAction1 := "SendInput,+{Home}"
		GV_KeyClickAction2 := "SendInput,^+{Home}"
		GoSub,Sub_KeyClick
	return

	` & y::
		GV_KeyClickAction1 := "SendInput,{Blind}{Home}+{End}"
		GV_KeyClickAction2 := "SendInput,^{Home}"
		GoSub,Sub_KeyClick
	
	return

	;点不是默认的“确定”或者OK按钮，如果没有就点第一个Button1，适用与那种简单的对话框，比如TC的备注
	` & Enter::
		try {
			SetTitleMatchMode RegEx
			SetTitleMatchMode Slow
			ControlClick, i).*确定|OK.*, A
		} catch e {
			ControlClick, Button1, A
		}
	return


	+`::SendInput,~
	`::SendInput,``
	^`::SendInput,^``
	!`::SendInput,!``
	+!`::SendInput,+!``

; ################# CapsLock相关 #################
	; 大写键控制上下左右
	CapsLock & s::
		{
			if GetKeyState("Alt") = 1 
				Send,^+{Tab}
			else if GetKeyState("Ctrl") = 1
				; 同类窗口的切换
				Send,^{Tab}
				; msgbox
			else 
				; Send "^{Tab}"
				Send,{Down}
				return
		}
	CapsLock & w::SendInput,{Blind}{Up}
		 
	CapsLock & a::SendInput,{Blind}{Left}
	CapsLock & d::SendInput,{Blind}{Right}

	; CapsLock & q::SendInput,{Blind}{PgUp}
	; CapsLock & f::SendInput,{Blind}{PgDn}
	CapsLock & q:: 
		{
			if GetKeyState("Alt") = 0 
				Send,^{F4}
			else 
				Send,!{F4}
			return
		} 

	; -----------------------------------o---------------------------------o
	;      键\修饰    	✱	     !(+)	      ^         ^!
	;        h         ←         选字        跳词      跳选词
	;        j         ↓         选字        跳词      跳选词
	;        k         ↑         选字        跳词      跳选词
	;        l         →         选字        跳词      跳选词
	; -----------------------------------o---------------------------------o
		CapsLock & h:: 
		{
			if GetKeyState("Ctrl") = 0 
			{ 
				if GetKeyState("Alt") = 0 
					; 无 左移一字
					Send {Left} 
				else 
					; ! 左选一字
					Send +{Left}
				return 
			} 
			else { 
				; ^ 左跳一词
				if GetKeyState("Alt") = 0 
					Send ^{Left}
				else 
				; ^! 左跳选一词
					Send +^{Left}
				return 
			} 
		} 


		CapsLock & j:: 
		{
			if GetKeyState("Ctrl") = 0 
			{ 
				if GetKeyState("Alt") = 0 
					Send {Down} 
				else 
					Send +{Down}
				return 
			} 
			else { 
				if GetKeyState("Alt") = 0 
					Send ^{Down}
				else 
					Send +^{Down}
				return 
			} 
		} 

		CapsLock & k:: 
		{
			if GetKeyState("Ctrl") = 0 
			{ 
				if GetKeyState("Alt") = 0 
					Send {Up}
				else 
					Send +{Up}
				return 
			} 
			else { 
				if GetKeyState("Alt") = 0 
					Send ^{Up} 
				else 
					Send +^{Up} 
				return 
			} 
		} 

		CapsLock & l:: 
		{
			if GetKeyState("Ctrl") = 0 
			{ 
				if GetKeyState("Alt") = 0 
					Send {Right}
				else 
					Send +{Right}
				return 
			} 
			else { 
				if GetKeyState("Alt") = 0 
					Send ^{Right} 
				else 
					Send +^{Right} 
				return 
			} 
		} 
	;=====================================================================o
	;                     CapsLock Home/End Navigator                    
	;-----------------------------------o---------------------------------o
	;                      CapsLock + i |  Home                          
	;                      CapsLock + o |  End                           
	;                      Ctrl, Alt Compatible                          
	;-----------------------------------o---------------------------------o
		CapsLock & i:: 
		{
			if GetKeyState("Ctrl") = 0 
			{ 
				if GetKeyState("Alt") = 0 
					Send {Home}
				else 
					Send +{Home}
				return 
			} 
			else { 
				if GetKeyState("Alt") = 0 
					Send ^{Home}
				else 
					Send +^{Home}
				return 
			} 
		} 

		CapsLock & o:: 
		{
			if GetKeyState("Ctrl") = 0 
			{ 
				if GetKeyState("Alt") = 0 
					Send {End}
				else 
					Send +{End}
				return 
			} 
			else { 
				if GetKeyState("Alt") = 0 
					Send ^{End}
				else 
					Send +^{End}
				return 
			} 
		} 
	;=====================================================================o
	;                      CapsLock Page Navigator                       
	;-----------------------------------o---------------------------------o
	;                      CapsLock + u |  PageUp                        
	;                      CapsLock + p |  PageDown                      
	;                      Ctrl, Alt Compatible                          
	;-----------------------------------o---------------------------------o
	CapsLock & u:: 
	{
		if GetKeyState("Ctrl") = 0 
		{ 
			if GetKeyState("Alt") = 0 
				Send {PgUp}
			else 
				Send +{PgUp}
			return 
		} 
		else { 
			if GetKeyState("Alt") = 0 
				Send ^{PgUp}
			else 
				Send +^{PgUp}
			return 
		} 
	} 

	CapsLock & p:: 
	{
		if GetKeyState("Ctrl") = 0 
		{ 
			if GetKeyState("Alt") = 0 
				Send {PgDn} 
			else 
				Send +{PgDn}
			return 
		} 
		else { 
			if GetKeyState("Alt") = 0 
				Send ^{PgDn}
			else 
				Send +^{PgDn}
			return 
		} 
	} 
	; Escape相关
;关闭和刷新
Escape & g:: SendInput,{Blind}^w
Escape & r:: SendInput,{Blind}^r
;切换tab
Escape & o:: send,{Blind}^+{Tab}
Escape & p:: send,{Blind}^{Tab}
;右键和DEL
;Escape & y:: send,{AppsKey}
Escape & y:: Send {Click Right}
Escape & d:: SendInput,{Delete}
;Alttab，Win8下暂时不能用
Escape & .:: AltTab
Escape & ,:: ShiftAltTab

Escape & `;:: WinClose A

;enter 回车窗口最大化
;Escape & Enter:: WinMaximize A
Escape & Enter:: GoSub,Sub_MaxRestore
Escape & Space:: WinMinimize A

^Escape:: SendInput,^{Escape}
+Escape:: SendInput,+{Escape}
!Escape:: SendInput,!{Escape}
^+Escape:: SendInput,^+{Escape}
^!Escape:: SendInput,^!{Escape}
!+Escape:: SendInput,!+{Escape}
^!+Escape:: SendInput,^!+{Escape}
^#u:: GoSub,OpenClipURLS
;最后一行恢复自身功能，重要

Escape::
	if (GV_EscKeyAs = "WinClose") {
		WinClose A
	}
	if (GV_EscKeyAs = "Backspace") {
		SendInput,{Backspace}
	}
	if (GV_EscKeyAs = "Escape") {
		SendInput,{Escape}
	}
	else if (GV_EscKeyAs = "CapsLock") {
		GetKeyState t, CapsLock, T
		IfEqual t,D, SetCapslockState AlwaysOff
		Else SetCapslockState AlwaysOn
	}
return

; ################# Tab相关 #################
	#If GV_ToggleTabKeys=1
		Tab & s::SendInput,{Blind}{Down}
		Tab & w::SendInput,{Blind}{Up}
		Tab & a::SendInput,{Blind}{Left}
		Tab & d::SendInput,{Blind}{Right}

	; Tab & q::SendInput,{Blind}{PgUp}
	; Tab & f::SendInput,{Blind}{PgDn}
		Tab & q::SendInput,{Blind}{Backspace}

		Tab & 1::SendInput,send,#1
		Tab & 2::SendInput,send,#2
		Tab & 3::SendInput,send,#3
		Tab & 4::SendInput,send,#4
		Tab & 5::SendInput,send,#5

		Tab & r::SendInput,{Blind}{Del}
		Tab & e::SendInput,{Blind}{Enter}
		Tab & Space::SendInput,{Blind}{Backspace}
		; 任务栏切换
		Tab & RButton::Gosub,<BoBO_TaskSwch>

		;恢复tab自身功能
		Tab::
			GV_KeyClickAction1 := "SendInput,{Tab}"
			GV_KeyClickAction2 := "SendInput,#{Tab}"
			GoSub,Sub_KeyClick
		return		

		Tab & v:: GoSub,menuBase

		#Tab:: SendInput,#{Tab}
		+Tab:: SendInput,+{Tab}
		^Tab:: SendInput,^{Tab}
		^+Tab:: SendInput,^+{Tab}
		Escape::SendInput,{Escape}
	#If

; ************** 分号;相关 ************** {{{2
	; `; & j:: SendInput,{Blind}{Down}
	; `; & k:: SendInput,{Blind}{Up}
	; `; & h:: SendInput,{Blind}{Left}
	; `; & l:: SendInput,{Blind}{Right}
	; `; & n:: SendInput,{Blind}{PgDn}
	; `; & m:: SendInput,{Blind}{PgUp}

	; `; & Space:: SendInput,{Delete}

	; `; & z::
	; 	GV_KeyClickAction1 := "SendInput,{Backspace}"
	; 	GV_KeyClickAction2 := "SendInput,+{Home}{Backspace}"
	; 	GoSub,Sub_KeyClick
	; return

	; `; & x::
	; 	GV_KeyClickAction1 := "SendInput,{Delete}"
	; 	GV_KeyClickAction2 := "SendInput,+{End}{Delete}"
	; 	GoSub,Sub_KeyClick
	; return

	; `; & c::
	; 	GV_KeyClickAction1 := "SendInput,^c"
	; 	GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^c"
	; 	GoSub,Sub_KeyClick
	; return

	; `; & b::
	; 	GV_KeyClickAction1 := "SendInput,^x"
	; 	GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^x"
	; 	GoSub,Sub_KeyClick
	; return

	; `; & v::
	; 	GV_KeyClickAction1 := "SendInput,^v"
	; 	GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^v"
	; 	GoSub,Sub_KeyClick
	; return

	; ;粘贴然后回车，多用在搜索框等输入的位置，一个双手，一个单手
	; `; & g::
	; 	GV_KeyClickAction1 := "SendInput,^v{Enter}"
	; 	GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^v{Enter}"
	; 	GoSub,Sub_KeyClick
	; return


	; ;搜索选中的文本
	; `; & s::GoSub,mGoogle


	; ;清空复制粘贴
	; `; & d::SendInput,{Home 2}+{End}{Backspace}
	; `; & a::SendInput,^{Home}^+{End}{Delete}



	; ;粘贴并转到,多数浏览器和tc中都可用
	; `; & u:: send,^t!d^v{Enter}
	; ;`; & u:: send,^t!dwww.^v{Enter}


	; `; & 1:: AscSend(fun_GetFormatTime("yyyy-MM-dd"))
	; `; & 2:: AscSend(fun_GetFormatTime(" HHmm"))
	; `; & 3:: AscSend("#" . fun_GetFormatTime("MMdd"))

	;恢复分号自身功能;
	;$`;:: SendInput,`;

;   跟espanso冲突所以注释一些
	; `;:: send,`;
	; ^`;:: send,^`;
	; +`;:: send,+`;
	; ^+`;:: send,^+`;
	; !`;:: send,!`;
	; ::: send,:
; ##########程序便捷.社交##########大部份来自EZ大神
	; TIM
		#If WinActive("ahk_class TXGuiFoundation") and WinActive("ahk_exe TIM.exe")
		{
			;点右键选撤回
			!c::
				send,{RButton}
				Sleep,100
				send,{Down 2}{Enter}
			Return
			;点右键选删除
			!d::
				send,{RButton}
				Sleep,200
				send,{Up 2}{Enter}
				Sleep,200
				send,{Enter}
			Return

			;快速到QQ接收的文件目录，请在config.ini对应修改qq号
			^f::CoordWinClick(92,48)
			; ^!f::CoordWinClick(1182,51)
			F4::Gosub, <BoBO_F4Close>
			!w::Gosub, <Tx_OpenWithTc>
			; !`::CoordWinClick(Tim_Start_X, Tim_Start_Y+(1-1)*Tim_Bar_Height)

			; !1::CoordWinClick(Tim_Start_X, Tim_Start_Y+(1-1)*Tim_Bar_Height)
			!1::CoordWinClick(Tim_Start_X, Tim_Start_Y+(2-1)*Tim_Bar_Height)
			!2::CoordWinClick(Tim_Start_X, Tim_Start_Y+(3-1)*Tim_Bar_Height)
			!3::CoordWinClick(Tim_Start_X, Tim_Start_Y+(4-1)*Tim_Bar_Height)
			!4::CoordWinClick(Tim_Start_X, Tim_Start_Y+(5-1)*Tim_Bar_Height)
			!5::CoordWinClick(Tim_Start_X, Tim_Start_Y+(6-1)*Tim_Bar_Height)
			!6::CoordWinClick(Tim_Start_X, Tim_Start_Y+(7-1)*Tim_Bar_Height)
			!7::CoordWinClick(Tim_Start_X, Tim_Start_Y+(8-1)*Tim_Bar_Height)
			!8::CoordWinClick(Tim_Start_X, Tim_Start_Y+(9-1)*Tim_Bar_Height)
			!9::CoordWinClick(Tim_Start_X, Tim_Start_Y+(10-1)*Tim_Bar_Height)
			!-::CoordWinClick(Tim_Start_X, Tim_Start_Y+(11-1)*Tim_Bar_Height)
			!=::CoordWinClick(Tim_Start_X, Tim_Start_Y+(12-1)*Tim_Bar_Height)
			; ^r::Gosub, <BoBO_Test>
		}
		#If

	; QQ
		#If WinActive("ahk_class TXGuiFoundation") and WinActive("ahk_exe qq.exe")
		{
			!1::CoordWinClick(QQ_Start_X, QQ_Start_Y+(1-1)*QQ_Bar_Height)
			!2::CoordWinClick(QQ_Start_X, QQ_Start_Y+(2-1)*QQ_Bar_Height)
			!3::CoordWinClick(QQ_Start_X, QQ_Start_Y+(3-1)*QQ_Bar_Height)
			!4::CoordWinClick(QQ_Start_X, QQ_Start_Y+(4-1)*QQ_Bar_Height)
			!5::CoordWinClick(QQ_Start_X, QQ_Start_Y+(5-1)*QQ_Bar_Height)
			!6::CoordWinClick(QQ_Start_X, QQ_Start_Y+(6-1)*QQ_Bar_Height)
			!7::CoordWinClick(QQ_Start_X, QQ_Start_Y+(7-1)*QQ_Bar_Height)
			!8::CoordWinClick(QQ_Start_X, QQ_Start_Y+(8-1)*QQ_Bar_Height)
			!9::CoordWinClick(QQ_Start_X, QQ_Start_Y+(9-1)*QQ_Bar_Height)
			!0::CoordWinClick(QQ_Start_X, QQ_Start_Y+(10-1)*QQ_Bar_Height)
			!-::CoordWinClick(QQ_Start_X, QQ_Start_Y+(11-1)*QQ_Bar_Height)
			!=::CoordWinClick(QQ_Start_X, QQ_Start_Y+(12-1)*QQ_Bar_Height)
			!w::Gosub, <Tx_OpenWithTc>
			return
		}
		#If

	; 微信
		#IfWinActive ahk_exe WeChat.exe
		{
			;聚焦搜索框
			!/::CoordWinClick(100,36)
			;点击绿色聊天的数字
			!,::
				CoordMode, Mouse, Window
				click 28,90 2
				Sleep,100
				click 180,100
			Return
			;聚焦打字框
			!`;::
				WinGetPos, wxx, wxy,wxw,wxh, ahk_class WeChatMainWndForPC
				wxw := wxw - 80
				wxh := wxh - 60
				CoordWinClick(wxw,wxh)
			return

			!1::CoordWinClick(WX_Start_X, WX_Start_Y+(1-1)*WX_Bar_Height)
			!2::CoordWinClick(WX_Start_X, WX_Start_Y+(2-1)*WX_Bar_Height)
			!3::CoordWinClick(WX_Start_X, WX_Start_Y+(3-1)*WX_Bar_Height)
			!4::CoordWinClick(WX_Start_X, WX_Start_Y+(4-1)*WX_Bar_Height)
			!5::CoordWinClick(WX_Start_X, WX_Start_Y+(5-1)*WX_Bar_Height)
			!6::CoordWinClick(WX_Start_X, WX_Start_Y+(6-1)*WX_Bar_Height)
			!7::CoordWinClick(WX_Start_X, WX_Start_Y+(7-1)*WX_Bar_Height)
			!8::CoordWinClick(WX_Start_X, WX_Start_Y+(8-1)*WX_Bar_Height)
			!9::CoordWinClick(WX_Start_X, WX_Start_Y+(9-1)*WX_Bar_Height)
			!0::CoordWinClick(WX_Start_X, WX_Start_Y+(10-1)*WX_Bar_Height)

			;快速到微信接收的文件目录，请自己修改对应目录
			!w::Gosub, <Wx_OpenWithTc>
			return
		}
		#If
	; telegram电报
		#IfWinActive ahk_exe Telegram.exe
		{
			!w::Gosub, <Tg_OpenWithTc>
			!/::CoordWinClick(150,52)
			!1::CoordWinClick(TG_Start_X, TG_Start_Y+(1-1)*TG_Bar_Height)
			!2::CoordWinClick(TG_Start_X, TG_Start_Y+(2-1)*TG_Bar_Height)
			!3::CoordWinClick(TG_Start_X, TG_Start_Y+(3-1)*TG_Bar_Height)
			!4::CoordWinClick(TG_Start_X, TG_Start_Y+(4-1)*TG_Bar_Height)
			!5::CoordWinClick(TG_Start_X, TG_Start_Y+(5-1)*TG_Bar_Height)
			!6::CoordWinClick(TG_Start_X, TG_Start_Y+(6-1)*TG_Bar_Height)
			!7::CoordWinClick(TG_Start_X, TG_Start_Y+(7-1)*TG_Bar_Height)
			!8::CoordWinClick(TG_Start_X, TG_Start_Y+(8-1)*TG_Bar_Height)
			!9::CoordWinClick(TG_Start_X, TG_Start_Y+(9-1)*TG_Bar_Height)
			!0::CoordWinClick(TG_Start_X, TG_Start_Y+(10-1)*TG_Bar_Height)
			return
		}
		#If
; ##########程序便捷.工具##########
		#IfWinActive ahk_exe 阿里云盘小白羊版v2.exe
		{
			!w::Gosub,<Ali_OpenWithTc>
		}
		#If
		#IfWinActive ahk_exe AnimPlayer.exe
		{
			q::sendinput,!{f4}
			return
		}
		#If
		#IfWinActive ahk_exe Billfish.exe
		{
			; 用默认应用打开IfWinActive  WinActivate
			; v::
			; v::
			; 	GV_KeyClickAction1 := "Gosub,<Billfish_open_default_local>"
			; 	GV_KeyClickAction2 := "Gosub,<Billfish_open_default_CopyPathToTC>"
			; 	GoSub,Sub_KeyClick
			; return	


			Return
		}
		#If
		#IfWinActive ahk_exe AnimPlayer.exe
		{
			Esc::send,!{f4}
		}
		#If
		#IfWinActive ahk_exe MassiGra.exe
		{
			MButton::sendinput,{LButton}
			RButton::sendinput,{LButton}
			2::sendinput,{RButton}
			WheelUp::sendinput,{+}
			WheelDown::sendinput,{-}
			Ctrl & LButton::
				GV_KeyClickAction1 := "SendInput,{f}"
				GV_KeyClickAction2 := "sendinput,{g}"
				GoSub,Sub_KeyClick
			return	
			F2::sendinput,{Left}
			F3::sendinput,{Right}
			F4::sendinput,!{F4}
			F5::
			/::
				if B_var=2 ; 总
				B_var=0
				B_var+=1
				bo_var=0
				if (B_var=1 )
				{ 
					sendinput,a
					sleep 100
					ControlGetText,Out,Edit1,确定 ahk_class #32770
					send,{Enter}
					return
				}
				if (B_var=2)
				{
					sendinput,{a}
					sleep 200
					ControlGetText,Out,Edit1,取消 ahk_class #32770
					return
				}
		}
		#If
		#IfWinActive ahk_exe Honeycam.exe
		{
			F5::sendinput,^+{x}
		}
		#If
		#IfWinActive ahk_exe XiaoChao.exe
		{
			ESC::sendinput,!+^{l}
			q::sendinput,!+^{l}
			; Alt & p::Run,%A_ScriptDir%\custom\apps\ShortCutHelper\设置.md
			; Alt & a::Run,%A_ScriptDir%\custom\apps\ShortCutHelper\local
			; Alt & q::sendinput,!+^{l}
			1::sendinput,{WheelUp}
			2::sendinput,{WheelDown}
		}
		#If
	; Everything
		#If WinActive("ahk_class EVERYTHING")
			{
				^Enter::
				ControlGetText,Keywords,Edit1,A
				OutputDebug %Keywords%
				run, http://www.baidu.com/s?wd=%Keywords% 
				; run, https://www.dogedoge.com/results?q=%Keywords%
				return
			}
		#If
		; 特效编辑器优化
		#If WinActive("ahk_exe adl.exe")
			{
				a::send,{f5} ;插入空帧
				+a::send,{F6} ;插入关键帧
				o::send,!{2} ;添加部件
				x::send,{f7} ;删除空帧
				+x::send,{Backspace} ;删除关键帧
				d::
					send,^{c}
					sleep,100
					send,^{v}
					return
				+d::send,{Delete}{Enter} ;删除组件不需要确认
			}
		#If
	; Notepad3
		#If WinActive("ahk_exe Notepad3.exe")
			{
				; q::
				; 	GV_KeyClickAction1 := "send,{q}"
				; 	GV_KeyClickAction2 := "send,!{F4}"
				; 	GoSub,Sub_KeyClick
				; return
				F1::send,!{F4}
				Alt & 1::send,!{F4}
			}
		#If
	; 智能跳转
		#If WinActive("ahk_group GroupDiagJump") and WinActive("ahk_class #32770")
		{
			!f::GoSub,<BoBO_HuntAndPeck>
			!e::GoSub,Sub_SendCurDiagPath2Exp		;发送对话框路径到_系统资管中
			!w:: GoSub,Sub_SendTcCurPath2Diag
			; Alt & LButton:: 
			; 	if GetKeyState("LButton", "p"){
			; 		GoSub,Sub_SendTcCurPath2Diag
			; 		Send,{LButton up}
			; 	Return
			; 	} 
			!t:: GoSub,Sub_SendCurDiagPath2Tc ;发送TC路径到对话框路径
			return
		}
		#If
	; 文本工具
		#If WinActive("ahk_exe notepad.exe")
		{
			q::
				GV_KeyClickAction1 := "send,{q}"
				GV_KeyClickAction2 := "send,!{F4}"
				GoSub,Sub_KeyClick
			return
		}
		#If
		#If WinActive("ahk_exe xnview.exe")
		{
			; 路径传递TC
			F9::
				ControlGetText, OutputVar, Edit1, A
				DiagPath := % OutputVar
				WinActivate ahk_class TTOTAL_CMD
				PostMessage 1075, 3001, 0, , AHK_CLASS TTOTAL_CMD
				ControlSetText, Edit1, cd %DiagPath%, ahk_class TTOTAL_CMD
				Sleep 400
				ControlSend, Edit1, {Enter}, ahk_class TTOTAL_CMD
			return
		}
		#If

		#If WinActive("下载完成 ahk_class #32770 ahk_exe IDMan.exe")
		{
			!g::
			RButton::
				ControlGetText,Out,Edit4
				WinClose A
				run,"%TCPath%" /T /O /S /L="%Out%"
				sleep 500
				MyWinWaitActive("ahk_class TTOTAL_CMD")
			return
		}

		;IDM界面
		#If WinActive("Internet Download Manager ahk_class #32770 ahk_exe IDMan.exe")
		{
			!f::
				run,"%TCPath%" /T /O /S /L="D:\Downloads\IDM\"
				sleep 500
				MyWinWaitActive("ahk_class TTOTAL_CMD")
			return
		}

		#If WinActive("ahk_exe ImageGlass.exe")
		{
			g:: send,^{Space}
			MButton:: send,^{Space}

			j:: send,^{PgUp}
			,:: send,^{PgUp}
			~LAlt & WheelUp::send,^{PgUp}
			
			k:: send,^{PgDn}
			.:: send,^{PgDn}
			~LAlt & WheelDown::send,^{PgDn}

			h:: send,{PgDn}
			l:: send,{PgUp}
			x:: send,{Esc}
			q:: send,{Esc}

		}
		#If

		#If WinActive("ahk_class HoneyviewClassX")
		{
			!WheelDown::send,{-}
			!WheelUp::send,{=}
			.:: send,{=}
			,:: send,{-}
			1:: 
				GV_KeyClickAction1 := "send,{-}"
				GV_KeyClickAction2 := "send,{0}"
				GoSub,Sub_KeyClick
			return
			
			2:: send,{=}
			`;::send,{Esc}

			g:: send,{0}
			j:: send,!{PgUp}
			k:: send,!{PgDn}

			h:: send,{PgDn}
			l:: send,{PgUp}
			x:: send,{Esc}
			~LButton::
				GV_KeyClickAction1 := "gosub,MoveWindows"
				GV_KeyClickAction2 := "send,{ESC}"
				GoSub,Sub_KeyClick
			return
		}


		#If WinActive("ahk_class IrfanView")
		{
			; ~LButton::
			; 	GV_KeyClickAction1 := "gosub,MoveWindows"
			; 	GV_KeyClickAction2 := "send,{ESC}"
			; 	GoSub,Sub_KeyClick
			; return
			;IrfanView自身支持ctrl+滚轮，但alt更好按，也不用多想到底哪一个按键
			!WheelDown::send,{-}
			!WheelUp::send,{+}
			.:: send,{+}
			,:: send,{-}
			`;::send,{Esc}

			;如果是动画，先按g暂停动画图片了后再按jk
			j:: send,{PgUp}
			k:: send,{PgDn}

			h:: send,{Left}
			l:: send,{Right}

			x:: send,i
			u:: send,{End}
			i:: send,{Home}
			/:: send,^h
			\:: send,+f

			c:: send,^c
			!r:: send,{F2}
			1:: send,!ofn{Enter}
			4:: send,!ofd{Enter}
			5:: send,!of{Up}{Enter}

			F11::
				send,!+s
				sleep,100
				send,!+t
				sleep,100
				send,!+m
				sleep,100
				send,!+c
			return
		}

		#If WinActive("ahk_class IrfanViewThumbnails")
		{
			j:: send,{Down}
			k:: send,{Up}
			h:: send,{Left}
			l:: send,{Right}
			x::ControlClick SysTreeView321
		}
; ##########程序便捷.浏览器########## 谷歌内核浏览器一般都支持 火狐没测
	#If WinActive("ahk_group group_browser")
	{
		;调用mpv播放
		!w::GoSub,Sub_Idm2Mpv
		; 新建
		F1::Send,^{t}
		; 切换向左
		F2::send,{Blind}^+{Tab} 
		; 切换向右
		F3::send,{Blind}^{Tab}
		; 关闭
		F4::SendInput,^w
		
		; 鼠标左右点击关闭
		~LButton & RButton::send ^w
		; 快速清理缓存
		~LButton & Delete::GoSub,<GoogleChrome_清除浏览数据>
		; 向前
		!LButton:: Browser_Forward
		; 返回d
		!RButton:: Browser_Back
		!d:: 
			clipboard=chrome://downloads/
			sleep,50
			SendInput,^{l}
			sleep,50
			SendInput,^{v}{Enter}
			return
		!p:: 
			clipboard=chrome://settings/
			sleep,50
			SendInput,^{l}
			sleep,50
			SendInput,^{v}{Enter}
			return
		!s:: 
			clipboard=chrome://extensions/
			sleep,50
			SendInput,^{l}
			sleep,50
			SendInput,^{v}{Enter}
			return
		; 定位输入栏

		F6::
			GV_KeyClickAction1 := "SendInput,^k"
			GV_KeyClickAction2 := "SendInput,^+{o}"
			GoSub,Sub_KeyClick
		return
		; 打开书签&Google
		; 键鼠操作
		; ~LButton & q::
		; 	GV_KeyClickAction1 := "OpenWebURL,google.com"
		; 	GV_KeyClickAction2 := "SendInput,^+{o}"
		; 	GoSub,Sub_KeyClick
		; return
		; ; 键盘操作
		; ~Alt & q::
		; 	GV_KeyClickAction1 := "OpenWebURL,google.com"
		; 	GV_KeyClickAction2 := "SendInput,^+{o}"
		; 	GoSub,Sub_KeyClick
		; return

		~Alt::
		{
			t := A_PriorHotkey == A_ThisHotkey && A_TimeSincePriorHotkey < 200 ? "off" : -200
			settimer, tappedkey_web, %t%
			if (t == "off")
			goto double_web
			return
			tappedkey_web:
				{
					SendInput,^{l}
					return
				}
			return

			double_web:
				{
					global get_browser_exe:= GetProcessBrowserPath()
					clipboard = %get_browser_exe%
					PopSel("web.lst")
					return
				}
		return
		}

		;按住左键点右键发送Ctrl+W关闭标签
		; ~LButton & RButton:: send ^w

		XButton1 & RButton::SendInput,^c
		XButton2 & RButton::SendInput,^c

		XButton1 & LButton::SendInput,^v
		XButton2 & LButton::SendInput,^v

		XButton2 & XButton1::GoSub,Sub_Idm2Mpv
		XButton1 & XButton2::GoSub,Sub_Idm2Mpv

		XButton1 & WheelUp::SendInput,{Blind}{Left}
		XButton2 & WheelUp::SendInput,{Blind}{Left}
		XButton1 & WheelDown::SendInput,{Blind}{Right}
		XButton2 & WheelDown::SendInput,{Blind}{Right}

		; 打开无痕模式&打开谷歌	
		F8::
			GV_KeyClickAction1 := "OpenWebURL,google.com"
			GV_KeyClickAction2 := "GoSub,<GoogleChrome_无痕>"
			GoSub,Sub_KeyClick
		return

		~Alt & g::
			GV_KeyClickAction1 := "OpenWebURL,google.com"
			GV_KeyClickAction2 := "OpenWebURL,fsofso.com"
			GoSub,Sub_KeyClick
		return
		~Alt & f::
			GV_KeyClickAction1 := "OpenWebURL,fsofso.com"
			GV_KeyClickAction2 := "OpenWebURL,google.com"
			GoSub,Sub_KeyClick
		return

		Space & q::
			GV_KeyClickAction1 := "send,!{Left}"
			GV_KeyClickAction2 := "send,!{Right}"
			GoSub,Sub_KeyClick
		return

		; Space & e::
		; 	GV_KeyClickAction1 := "send,{e}"
		; 	GV_KeyClickAction2 := "send,!{Right}"
		; 	GoSub,Sub_KeyClick
		; return
		Space::send,{Space}

	; 滚轮切换标签
		; ~$WheelDown::
		; ~$WheelUp::
		; 	MouseGetPos,, ypos
		; 	If (ypos>40) Or (ypos<0)
		; 	Return
		; 	IfEqual,A_ThisHotkey,~$WheelDown, Send ^{PgDn}
		; 	Else Send ^{PgUp}
		; 	EmptyMem()
		; 	return
	; 双击关闭
		; ~LButton::
		; 	WinGetPos,,, w, h, A
		; 	MouseGetPos,xpos, ypos
		; 	WinGet,Mom,MinMax
		; 	If ((ypos>45)And(Mom<1))Or((ypos>28)And(Mom>0)) Or (ypos<0)
		; 	Return
		; 	If (A_PriorHotkey="~LButton") and (A_TimeSincePriorHotkey<200)
		; 	; 此处和知乎版本不同 ↓
		; 	send ^w
		; 	; 此处和知乎版本不同 ↑
		; 	return
		LButton::
			Send,{LButton Down}
			if(A_Cursor="Unknown"){
				MouseGetPos,smx,smy
				KeyWait,LButton,U
				MouseGetPos,nmx,nmy
				k:=Abs(nmx-smx)+Abs(nmy-smy)
				if(k>30 and k<200){
					Send,{Esc}
					Sleep,1
					c:=(nmy-smy>0)?"^{LButton}":"+^{LButton}"
					MouseMove,smx,smy
					Send,%c%
				} else {
					Send,{LButton Up}
				}
			} else {
				KeyWait,LButton,U
				Send,{LButton Up}
			}
		return

	; 右键关闭标签
		~RButton Up::
		~RButton::
			MouseGetPos,xpos, ypos
			WinGet,Mom,MinMax
			If ((ypos>45)And(Mom<1))Or((ypos>28)And(Mom>0)) Or (ypos<0)
			Return
			if  GetKeyState("1")
				Return
			IfEqual,A_ThisHotkey,~RButton, Send {Click Middle}
										Else Send {Click middle}
			EmptyMem()
			return

	}
	#If
; ##########在浏览器中单独启用空格组合键##########
	#If WinActive("ahk_group group_browser") and (GV_GroupBrowserToggleSpaceKeys = 1)
	{

		Space & j:: SendInput,{Blind}{Down}
		Space & k:: SendInput,{Blind}{Up}
		Space & h:: SendInput,{Blind}{Left}
		Space & l:: SendInput,{Blind}{Right}

		Space & w:: SendInput,{Blind}^{Right}
		Space & b:: SendInput,{Blind}^{Left}

		Space & e:: SendInput,{Blind}{PgDn}
		Space & q:: SendInput,{Blind}{PgUp}

		Space & s:: SendInput,^v{Enter}
		Space & \:: SendInput,^a^v{Enter}

		;在链接上右键菜单，然后选另存为
		Space & a:: 
			Send,{RButton}
			sleep,200
			send,k
		return

		;复制文本
		Space & RButton:: SendInput,^c

		Space & LButton::
			If (GetCursorShape() = GV_CursorInputBox){
				SendInput,{Click}
				sleep,100
				SendInput,^v{Enter}
			} else if(GetCursorShape() = GV_CursorClick) {
				SendInput,{MButton}
			} else {
				SendInput,{Enter}
			}
		return

		;连击3下用来选中文本段落，然后复制
		Space & XButton1:: 
			Send,{Click 3}
			sleep 100
			Send,^c
		return

		Space & c::
			GV_KeyClickAction1 := "SendInput,^c"
			GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^c"
			GoSub,Sub_KeyClick
		return

		Space & x::
			GV_KeyClickAction1 := "SendInput,^x"
			GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^x"
			GoSub,Sub_KeyClick
		return

		Space & v::
			GV_KeyClickAction1 := "SendInput,^v"
			GV_KeyClickAction2 := "SendInput,^{Home}^+{End}^v"
			GoSub,Sub_KeyClick
		return

		Space & u::
			GV_KeyClickAction1 := "SendInput,{End}"
			GV_KeyClickAction2 := "SendInput,^{End}"
			GoSub,Sub_KeyClick
		return

		Space & i::
			GV_KeyClickAction1 := "SendInput,{Home}"
			GV_KeyClickAction2 := "SendInput,^{Home}"
			GoSub,Sub_KeyClick
		return

		Space & n::
			GV_KeyClickAction1 := "SendInput,{PgDn}"
			GV_KeyClickAction2 := "SendInput,^{PgDn}"
			GoSub,Sub_KeyClick
		return

		Space & m::
			GV_KeyClickAction1 := "SendInput,{PgUp}"
			GV_KeyClickAction2 := "SendInput,^{PgUp}"
			GoSub,Sub_KeyClick
		return

		Space & f::GoSub,Sub_Idm2Mpv


		$Space::send,{Blind}{space}
		^Space::^Space
		+Space::+Space
	}
	Sub_Idm2Mpv:
		;先点击IDM浮动
		ControlGetPos, x, y, w, h, IDM Download Button class1
		ControlClick, IDM Download Button class1, , , LEFT, 1, x12 y8
		sleep 500
		MouseMove, x,y
		;再来处理，自己在30秒钟内选择具体哪一条清晰度等
		WinWaitActive, 下载文件信息 ahk_class #32770, , 30
		if ErrorLevel
		{
			return
		}
		else
		{
			;ControlGetText,Out,Edit1,下载文件信息 ahk_class #32770 ahk_exe IDMan.exe
			ControlGetText,Out,Edit1,下载文件信息 ahk_class #32770
			WinClose,下载文件信息 ahk_class #32770
			run,%TCDirPath%\Plugins\WLX\vlister\mpv.exe "%Out%"
		}
	return
; ##########系统&资源管理器&桌面&任务栏##########
	;资源浏览器
		#If WinActive("ahk_class CabinetWClass") or WinActive("ahk_class ExploreWClass")
		{
			!w::openPathTc() ;Explorer到 TC 互相调用【alt+w】
			NumpadDiv::HideShowfiles() ;显示隐藏文件
			^!t::Gosub,<BoBO_OpenLocalDirCommander>
			LButton & x::Gosub,Run_ClsClose ;关闭重复窗口
			^!w::Gosub,Run_ClsClose ;关闭重复窗口
			; 1::Gosub,ZipDirectory ;关闭重复窗口
			^#z::Gosub,ZipDirectory
			~MButton::Send !{Up} ;中键上一级
			`::Send !{Up} ;中键上一级
		}
		#If 
	;桌面
		#If WinActive("ahk_class Progman") or WinActive("ahk_class WorkerW")
		{
			;!w::openPathTc() ;桌面到TC
			!q::HideOrShowDesktopIcons() ;隐藏、显示桌面图标！
			; ~LButton::
			; 	if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 200)
			; 		gosub,<TC_ToggleTC>
			; return
			;桌面到TC
			!w:: 
				if(TCPath="")	
					return
				selected := Explorer_GetPath()
				if(selected = ""){
					selected := """" A_Desktop """"
					run, %TCPath% /T /O /A /S /L=%selected%
					sleep 200
					selected := """" A_DesktopCommon """"
					run, %TCPath% /T /O /A /S /R=%selected%
				}
				else{
					selected := """" selected """"
					run, %TCPath% /T /O /S /A /L=%selected%
				}
			return
			; g::
			;     p := ClickAndLongClick()
			; 	If (p = "0")
			; 	{
			; 		;openPathTc()
			; 		sendinput,#{1}
			; 		return
			; 	}
			; 	If (p = "1")	
			; 	{
			; 		;openPathTc()
			; 		;gosub,<TC_ToggleTC>
			; 		sendinput,#{1}
			; 		return
			; 	}
			; 	Else{
			; 	;run,https://www.google.com
			; 	; sendinput,#{2}
			; 	PopSel("")
			; 	return
			; 	}
			; return
			!d::
				gosub,<EmptyRecycle>
			return
		}
		#If 
	;任务栏
		#If MouseIsOver("ahk_class Shell_TrayWnd")
		{	
			;在任务栏上滚轮调整音量 {{{2
			WheelUp::Send {Volume_Up}
			WheelDown::Send {Volume_Down}
			;在任务栏上双击显示桌面
			~Alt & LButton::
				; if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 200)
						send,#{d}
				return
			; ~Alt & RButton::
			; 	PopSel("work.lst")
			; 	return
			#RButton::Gosub,PopSelSystem
			~Alt::
				GV_KeyClickAction1 := "Gosub,<TaskSwch>"
				GV_KeyClickAction2 := "Gosub,PopSelSystem"
				GoSub,Sub_KeyClick
				return
		}
		#If
; ##########程序便捷.Total Commander##########
	#If WinActive("ahk_class TTOTAL_CMD")
	{
		; !w::openPathExplorer() ;TC 到 Explorer
		; !g:: GoSub,Sub_SendTcCurPath2Diag
		+RButton::Gosub,menuTc
		NumpadDiv::TcSendPos(2011) ;显示隐藏文件
		^!t::Gosub,<BoBO_OpenLocalDirCommander>
		^Up::Gosub,<TcPostMsg>
			,:: 
			ControlGetFocus, TC_CurrentControl, A
			;TInEdit1 地址栏和重命名 Edit1 命令行
			if (RegExMatch(TC_CurrentControl, "TMyListBox1|TMyListBox2"))
				TcSendPos(524)   ;cm_ClearAll
			else
				send,`,
		return
		;复制到对面选中目录
		^!F5::
			send,{Tab}^+c{Tab}{F5}
			Sleep,500
			send,^v
			Sleep,500
			send,{Enter 2}
		return
		;移动到对面选中目录
		^!F6::
			send,{Tab}^+c{Tab}{F6}
			Sleep,500
			send,^v
			Sleep,500
			send,{Enter 2}
		return
		;中键点击，在新建标签中打开
		MButton::
			Send,{Click}
			Sleep 50
			TcSendPos(3003)
		return

		Alt::
			; GV_KeyClickAction1 := "Gosub,<cm_DirectoryHotlist>"
			; GV_KeyClickAction2 := "Gosub,menuTc"
			; GoSub,Sub_KeyClick
			keyPress:=analyseKeyPress("Alt")
			; tooltip %keypress%
			if (keypress=1)
				Gosub,<cm_DirectoryHotlist>
			if (keypress=2)
				Gosub,menuTc
			if (keypress=3)
				Gosub,<TC_azHistory_Mod>
		return

		/::
			GV_KeyClickAction1 := "send,{/}"
			GV_KeyClickAction2 := "Gosub,<cm_SrcPathFocus2>"
			GoSub,Sub_KeyClick
		return

		~LButton & RButton::
			Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`cm_MatchSrc`)"
		return


		;双击右键，发送退格，返回上一级目录
		~RButton::
			KeyWait,RButton
			KeyWait,RButton, d T0.1
			If ! Errorlevel
			{
			send {Backspace} 
			}
		Return
		;智能对话框跳转 f
		; ~Alt & LButton::Gosub,Sub_SendTcPathCurDiag
		!w::
			GV_KeyClickAction1 := "Gosub,Sub_SendTcPathCurDiag"
			GV_KeyClickAction2 := "Gosub,Sub_SendTcPathExplorer"
			GoSub,Sub_KeyClick
		return

		!+w::openPathExplorer() ;TC 到 Explorer
		~LButton & x::
			Send,^+{w}
		return

		; ~LCtrl & c::
		; 	GV_KeyClickAction1 := "Send,^{c}"
		; 	GV_KeyClickAction2 := "Gosub,<cm_CopyFullNamesToClip>"
		; 	GoSub,Sub_KeyClick
		; return
			;智能对话框跳转 f
		; ~n::
		; 	GV_KeyClickAction1 := "Send,{n}"
		; 	GV_KeyClickAction2 := "TcSendPos(907)"
		; 	GoSub,Sub_KeyClick
		; return
		; 新建文件夹
		F7::
			GV_KeyClickAction1 := "TcSendPos,907"
			GV_KeyClickAction2 := "TcSendPos,2931"
			GoSub,Sub_KeyClick
		return
		F8::
			GV_KeyClickAction1 := "Gosub,<TcCountDirContent>"
			GV_KeyClickAction2 := "Gosub,<cm_DirBranch>"
			GoSub,Sub_KeyClick
		return
		~LButton & F8::
			TcCMD("tem(`cm_DirBranchSel`)")
		return
		; 	TcCMD("tem(`cm_MkDir`)")
		; return
		;按住Tab 鼠标左键 交换两侧
		Tab & LButton::
			Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`cm_Exchange`)"
		return
		
		` & 1::
		; ~Ctrl & LButton::
			send,^+{Tab}
		return

		` & 2::
		; ~Ctrl & RButton::
			send,^{Tab}
		return

		; ~Shift & LButton::
		; 	send,^+{Tab}
		; return
		;按住Space 两侧同时滚动
		Space & WheelDown::Tc_WindowScroll(0)		
		Space & WheelUp::Tc_WindowScroll(1)		

		; ^!q::
		; 	gosub,<TC_test>
		; Return

		; Tc点击空白完成重命名操作
		#If reTcNameEdit()
			Lbutton::Send {enter}
			return

		!w::
		!LButton::
			Dlg_HWnd := WinExist("ahk_group GroupDiagJump")
			if Dlg_HWnd 
			;IfWinExist ahk_group GroupDiagOpenAndSave
			{
				WinGetTitle, Dlg_Title, ahk_id %Dlg_HWnd%
				If RegExMatch(Dlg_Title, "Save|Save As|另存为|保存|图形另存为|保存副本"){
					;msgbox "这是保存对话框"
					orgClip:=clipboardAll
					Clipboard =
					;PostMessage, TC_Msg, CM_CopyFullNamesToClip,0,, ahk_class TTOTAL_CMD
					Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`CM_CopyFullNamesToClip`)"
					; TcSendPos(CM_CopyFullNamesToClip)
					ClipWait, 1
					selFiles := Clipboard
					Clipboard:=orgClip
					selFilesArray := StrSplit(selFiles, "`n","`r")
					if selFilesArray.length() > 1 {
						selFiles:=selFilesArray[1]
						; eztip("对话框是保存类型，只认第一个文件",1)
					}
					StringGetPos OutputVar, selFiles,`\,R1
					StringMid, filePath, selFiles,1, OutputVar+1
					StringMid, fileName, selFiles,OutputVar+2,StrLen(selFiles)-OutputVar

					IfWinNotActive, %Dlg_Title% ahk_id %Dlg_HWnd%, , WinActivate, %Dlg_Title% ahk_id %Dlg_HWnd%
					WinWaitActive, %Dlg_Title% ahk_id %Dlg_HWnd%
					if !ErrorLevel
					{
						ControlGetText, orgFileName,Edit1
						ControlFocus, Edit1,
						sleep 200
						Send,{Backspace}
						sleep 300
						setKeyDelay, 10,10
						ControlSetText, Edit1, %filePath% 
						sleep 900
						send,{enter}
						sleep 500
						if StrLen(fileName) > 0 {
							ControlSetText, Edit1, %fileName% 
						}
						else{
							ControlSetText, Edit1, %orgFileName% 
						}
					}
				}
				else {
					; msgbox "打开对话框"
					orgClip:=clipboardAll
					Clipboard =
					;PostMessage, TC_Msg, CM_CopyFullNamesToClip,0,, ahk_class TTOTAL_CMD
					; TcSendPos(CM_CopyFullNamesToClip)
					Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`CM_CopyFullNamesToClip`)"
					ClipWait, 1
					selFiles := Clipboard
					Clipboard:=orgClip
					selFilesArray := StrSplit(selFiles, "`n","`r")
					quote:=(selFilesArray.length() > 1) ? """" : ""
					selFiles=
					Loop % selFilesArray.MaxIndex()
					{
						this_file := selFilesArray[A_Index]
						selFiles=%selFiles% %quote%%this_file%%quote%
					}
					IfWinNotActive, %Dlg_Title% ahk_id %Dlg_HWnd%, , WinActivate, %Dlg_Title% ahk_id %Dlg_HWnd%
					WinWaitActive, %Dlg_Title% ahk_id %Dlg_HWnd%
					if !ErrorLevel
					{
						sleep 300
						setKeyDelay, 10,10
						ControlSetText, Edit1, %selFiles%
						send, {Enter}
					}
				}
				; reload
			}
			else{
				; 打开默认资源管理器
				openPathExplorer()
			}
		return
	}
	#If
; ##########程序便捷.办公##########
	; Word
		#If WinActive("ahk_class OpusApp")
		{
			!w::Gosub, <BoBO_OpenLocalFliesWord>
		}
		#If
	; Excel
		#If WinActive("ahk_class XLMAIN")
		{
			!w::Gosub, <BoBO_OpenLocalFliesExcel>
		}
		#If
	; PowerPoint
		#If WinActive("ahk_class Case_POWERPNT")
		{
			!w::Gosub, <BoBO_OpenLocalFliesPowerPoint>
		}
		#If

	; Photoshop
		#If WinActive("ahk_exe Photoshop.exe")
		{	
			` & 1:: Gosub, <PS_透明度减>
			` & 2:: Gosub, <PS_透明度加>
			` & 3:: Gosub, <PS_明颜色>
			` & 4:: Gosub, <PS_暗颜色>
			` & 5:: Gosub, <PS_加暗加亮>


			` & WheelDown::sendinput, {[}	;缩小画笔
			` & WheelUp::sendinput,{]} 			;放大画笔

			; `::send,{b}
			` & LButton::Gosub, ps_double_BrushSwith
			
			`::
				GV_KeyClickAction1 := "send,{b}"
				GV_KeyClickAction2 := "Gosub,<PS_eraserTool>"
				GoSub,Sub_KeyClick
			return
		}
		#If
	; 3DsMax
		#If WinActive("ahk_exe 3dsmax.exe")
		{
			` & 1:: Gosub, <3DsMax_getUp>
			` & 2:: Gosub, <3DsMax_getDown>
			` & 3:: Gosub, <3DsMax_Key>
			return
		}
		#If
	;Unreal Engine
		#If WinActive("ahk_exe UE4Editor.exe")
		{
			; s::
			; 	GV_KeyClickAction1 := "SendInput,{s}"
			; 	GV_KeyClickAction2 := "GoSub,<Unreal_RButton>"
			; 	GoSub,Sub_KeyClick
			; Return
		}
		#If 
	;Blender
		#If WinActive("ahk_exe blender.exe")
		{
			; MButton::BetterBlenderNav()
			`::sendinput,^{Space}
			LButton & F2::send,{F2}
			; Space::    
			; 	start := A_TickCount            ; measure current time.
			; 	KeyWait, Space                    ; wait for Space to be released.
			; 	duration := A_TickCount - start ; calculate if Space was held for less than ### ms.
			; 	if (duration < 180){            ; if so
			; 		SendEvent, {Space}            ; send Space else send nothing. 
			; 	}
			; 	return
            ; Alt::    
			; 	start := A_TickCount            ; measure current time.
			; 	KeyWait, Alt                    ; wait for Space to be released.
			; 	duration := A_TickCount - start ; calculate if Space was held for less than ### ms.
			; 	if (duration < 180){            ; if so
			; 		SendEvent, {Alt}            ; send Space else send nothing. 
			; 	}
			; 	return
			; LButton::
			; 	if GetKeyState("Space", "p"){ ; If Spacebar is being held down while Mouse button is pressed.
			; 		Send {MButton Down}  
			; 		KeyWait, LButton 
			; 		Send {MButton Up}
			; 	return   
			; 	} 
            ;     if GetKeyState("Alt", "p"){ ; If Spacebar is being held down while Mouse button is pressed.
			; 		Send {MButton Down}   
			; 		KeyWait, LButton
			; 		Send {MButton Up}
			; 	return   
			; 	}else {
			; 		Click, down ; Click is necessary over Send as the button sometimes stops responding for unknown reasons.
			; 		KeyWait, LButton
			; 		Click, up
			; 		return 
			; 	} 
			; 	return
			Alt & RButton::
				if GetKeyState("RButton", "p"){
					SendEvent, ^{MButton Down}
					KeyWait, RButton
					SendEvent, ^{MButton Up}
					Return
				} else {
					Click, down, Right
					KeyWait, RButton
					Click, up, Right
					return
				}
				return
			Alt & LButton::
				if GetKeyState("Lbutton", "p"){ ; If Spacebar is being held down while Mouse button is pressed.
					Send {MButton Down}  
					KeyWait, LButton 
					Send {MButton Up}
				return   
				}
			Alt & MButton::
			; ; MButton::
					if GetKeyState("Mbutton", "p")
					{
						sendinput, +{Mbutton down}
						KeyWait, Mbutton
						Click, up, Right
						Send, {Mbutton up}
						Return
					}
			return
			; MButton up::
			; 	SendEvent {Mbutton up}
			; ; Return
			; Tab::goSub,<Blender_模式切换> 
		}
		#If

	; Evetything
		#If WinActive("ahk_exe Everything.exe")
			{
				;点右键选撤回
				^c::
					send,{RButton}
					Sleep,100
					send,{Down 3}
				Return
				}
		#If
		; Evetything
		#If ActiveControlIs2("AmplifyShaderEditor.AmplifyShaderEditorWindow")
			{
				;点右键选撤
				1::msgbox,"Hello"
				return

			}
		#If
	menuPsAlt:
		menu, menuPsAlt, add,用AE编辑, Ps_UserAeEidtor
		menu, menuPsAlt, add,在TC显示, Ps_TotalCMD
		; menu, menuPsAlt, add,在资源管理器显示, Ps_Export
		menu, menuPsAlt, Show
	return
	Ps_UserAeEidtor:
		run,python.exe %A_ScriptDir%\custom\ps_script\openAE.py
	return
	Ps_TotalCMD:
		run,python.exe %A_ScriptDir%\custom\ps_script\openTC.py
	return
	Ps_Export:
		MsgBox, "有需求在写"
	return

; ##########程序便捷.菜单##########
	; 菜单
		menuBase:
			Menu, menuBase, UseErrorLevel
			Menu, menuBase, DeleteAll
			Menu, menuBase, Add, (&S) %_searchGoogle%, mGoogle
			Menu, menuBase, Add, (&F) %_searchGoogleTranslate%, mGoogleTranslate
			Menu, menuBase, Add, (&S) 智能处理, mSmartProcess
			; Menu, menuBase, Add, (&B) %_searchBaidu%, mBaidu
			Menu, menuBase, Add  ; 添加分隔线.
			Menu, menuBase, Add, (&P) 用MPV播放器, Sub_OpenUrlByPlayer
			Menu, menuBase, Add, (&S) 视频下载, mSmartDownload
			Menu, menuBase, Add, (&S) yt-dlp下载, mYTDownload
			Menu, menuBase, Show
		return
		menuTc:
			Menu, menuTc, add,新建,:createDir
			Menu, createDir, add,新建文件夹,<Tools_MkDir>
			Menu, createDir, add,新建文件夹_日期,<Tools_NewFilesDate>
			Menu, createDir, add,计算文件大小,<TcCountDirContent>
			Menu, createDir, add,我的目录,<em_TBoBO_Path>
				

			Menu, menuTc, add,转换, :transformSet
			Menu, transformSet, add, Png转Gif,<em_BoBO_PNGToGIF>
			Menu, transformSet, add, Png转Ico,<em_BoBO_PNGToICO>
			Menu, transformSet, add, DDS转PNG,<em_BoBO_DDSToPNG>
			Menu, transformSet, add, 合并图片为PDF,<em_Magic_MergeJPG2PDF>
			Menu, transformSet, add, 中文转拼音,<Tools_ChineseConversionPinyin>
			Menu, transformSet, add, Atlas转PNG,<Tools_ChineseConversionPinyin>

			; IniRead, myCompany,config.ini, coDnfig, myCompany, 1
			; if myCompany = kuaiyou
			; {
			Menu, menuTc, add,游戏开发, :GameDevSet
			Menu, GameDevSet, add, 复制txt目录结构,<em_BoBO_txtCopy>
			Menu, GameDevSet, add, 打包_H5,<TC_打包工具_打包Atlas>
			Menu, GameDevSet, add, 打包_H5_New图集,<TC_打包工具_打包Atlas2>
			Menu, GameDevSet, add, 打包_SSP,<TC_打包工具_打包SSP>
			Menu, GameDevSet, add, SSP转PNG,<TC_打包工具_ssp转png>
			Menu, GameDevSet, add, Atlas转PNG,<TC_打包工具_atlas转png>
			Menu, GameDevSet, add, 拷贝打包资源,<em_work_copyGameFileTxt>
			Menu, GameDevSet, add, fxjID修改,<em_work_fxjid>
			Menu, GameDevSet, add, ATtlas前缀修改,<GameDevSetAtlas>
			Menu, GameDevSet, add, 删除游戏资源,<GameDevDeleteH5>
			Menu, GameDevSet, add, 编辑器 >> 仙谕,<GameDevSetFxEditorXY>
			Menu, GameDevSet, add, 编辑器 >> 三国,<GameDevSetFxEditorSG>
			; }
			Menu, menuTc, add,工具, :Toolset
			Menu, Toolset, add, 整理: PNG恢复目录,<em_BoBO_pngFilesRest>
			Menu, Toolset, add, 整理: PNG展开,<em_BoBO_openFilesDir>
			Menu, Toolset, add, 整理: 按文件类型,<Tools_Classification>
			Menu, Toolset, add, 整理: 递归文件到当前目录,<Tools_MoveFilesToDir>
			Menu, Toolset, add, 整理: 当前文件向上移,<Tools_MoveUpDir>
			Menu, Toolset, add, 整理: 关闭重复标签,<TC_关闭重复标签>
			Menu, Toolset, add, 删除: 空目录,<Tools_NullDir>
			Menu, Toolset, add, 删除: PNG文件,<Tools_DeletePNG>
				

			Menu, menuTc, add,重命名, :workReName
			Menu, workReName, add, 命名为: 标准,<em_BoBO_RenName_default>
			Menu, workReName, add, 命名为: 一级目录名+文件名,<em_work_rename_1>
			Menu, workReName, add, 命名为: 二级目录+文件名,<em_work_rename_2>
			Menu, workReName, add, 命名为: 三级目录+文件名,<em_work_rename_3>
			Menu, workReName, add, 命名为: JBT规范,<em_work_rename_jbt>

			Menu, menuTc, add,图片, :TcIMG
			Menu, TcIMG, add, 编辑: 在AfterEffect编辑,<menuTcToAe>
			Menu, TcIMG, add, 根据原图和对应的alpha图提取,<em_BoBO_PNGToAlpha>
				
			Menu, menuTc, add,命令行, :CommanderSet
			Menu,CommanderSet , add, AE: 批渲染,<em_BoBO_AeRender>
			Menu,CommanderSet , add, Test,<TcPostMsgTest>

			Menu, menuTc, add,&S 搜索, :SearchSet
			Menu,SearchSet , add, Everything搜索当前目录,<em_Search_everything>
			Menu,SearchSet , add, Everything搜索文件名,<em_Search_SearchTCFileName>
			Menu,SearchSet , add, Google搜索文件名,<em_Search_GoogleName>
			Menu,SearchSet , add, Google翻译文件名,<em_Search_GoogleTranslator>
			Menu,SearchSet , add, 百度-搜索文件名,<em_Search_Baidu>
			Menu,SearchSet , add, 萌搜-搜索文件名,<em_Search_Mengso>

			Menu, menuTc, add,&F FFmpeg处理, :FFmpegSet
			Menu, FFmpegSet, add, ffmpeg-视频转图片,<FFmpeg_Video_img>
			Menu, FFmpegSet, add, ffmpeg-视频转gif,<FFmpeg_Video_gif>
			Menu, FFmpegSet, add, ffmpeg-ts转mp4,<FFmpeg_Video_tsmp4>
			Menu, FFmpegSet, add, ffmpeg-mp4提取音频,<ffmpeg_Video_mp4ac>
	
			Menu, menuTc, add,菜单栏, <em_TrackMainMenu>, <em_TrackMainMenu>
			Menu, menuTc, Show
		return 
		menuFSCapture:
			Menu, menuFSCapture, UseErrorLevel
			Menu, menuFSCapture, DeleteAll
			Menu, menuFSCapture, Add, (&A) 矩形区域, <FSCapture_矩形区域>
			Menu, menuFSCapture, Add, (&S) 窗口或对象, <FSCapture_窗口或对象>
			Menu, menuFSCapture, Add, (&D) 激活窗口, <FSCapture_激活窗口>
			Menu, menuFSCapture, Add, (&Z) 滚动窗口, <FSCapture_滚动窗口>
			Menu, menuFSCapture, Add, (&X) 手绘区域, <FSCapture_手绘区域>
			Menu, menuFSCapture, Add, (&C) 固定大小区域, <FSCapture_固定大小区域>
			Menu, menuFSCapture, Add, (&Q) 整屏, <FSCapture_整个屏幕>
			Menu, menuFSCapture, Add, (&W) 系统自带截图, <FSCapture_系统自带截图>
			Menu, menuFSCapture, Show
		return



	Sub_OpenUrlByPlayer:
		sendinput,^c
		sleep,100
		StringLeft,clipboard_left,clipboard,500
		ToolTip 打开播放：%clipboard_left%
		SetTimer, ToolTipOff, -1000
		clip:=
		clip:=clipboard
		run,%A_ScriptDir%\tools\TotalCMD\Plugins\WLX\vlister\mpv.exe "%clip%"
	return


mGoogle:
	sendinput,^c
	sleep,100
	StringLeft,clipboard_left,clipboard,500
	ToolTip 搜索：%clipboard_left%
	SetTimer, ToolTipOff, -1000
	clip:=
	clip:=clipboard
	If RegExMatch(clip, "^\d{6}$"){
		Out := gv_url_tdx_f10 . clip . gv_url_html
		run,%Out%
	}
	else{
		Run,https://www.google.com/search?hl=zh-CN&lr=lang_zh-CN&q=%clip%
		}
	return
return

mGoogleTranslate:
	sendinput,^c
	sleep,100
	StringLeft,clipboard_left,clipboard,500
	ToolTip 翻译：%clipboard_left%
	SetTimer, ToolTipOff, -1000
	clip:=
	clip:=clipboard
		If RegExMatch(clip, "^\d{6}$"){
		Out := gv_url_tdx_f10 . clip . gv_url_html
		run,%Out%
	}
	else{
	Run,https://translate.google.com/?source=osdd#auto|auto|%clip%
		}
	return
return
mToutiao:
	send,^c
	sleep,100
	clip:=
	clip:=clipboard
	Run,https://so.toutiao.com/search?dvpf=pc&source=input&keyword=%clip%
return
mBaidu:
	send,^c
	sleep,100
	clip:=
	clip:=clipboard
	Run,https://www.baidu.com/s?wd=%clip%
return
mANNIE:
	send,^c
	sleep,100
	clip:=
	clip:=clipboard
	Run,%A_ScriptDir%\tools\TotalCMD\Tools\Python\Python37\python.exe -i %A_ScriptDir%\tools\TotalCMD\Tools\Python\批处理_视频下载.py %clip%
return
mANNIEOnly:
	send,^c
	sleep,100
	clip:=
	clip:=clipboard
	Run,%A_ScriptDir%\tools\TotalCMD\Tools\Python\Python37\python.exe -i %A_ScriptDir%\tools\TotalCMD\Tools\Python\批处理_视频下载单.py %clip%
return
mANNIEPROXY:
	send,^c
	sleep,100
	clip:=
	clip:=clipboard
	Run,%A_ScriptDir%\tools\TotalCMD\Tools\Python\Python37\python.exe -i %A_ScriptDir%\tools\TotalCMD\Tools\Python\批处理_视频下载单YT.py %clip%
return
mANNIEPROXYList:
	send,^c
	sleep,100
	clip:=
	clip:=clipboard
	Run,%A_ScriptDir%\tools\TotalCMD\Tools\Python\Python37\python.exe -i %A_ScriptDir%\tools\TotalCMD\Tools\Python\批处理_视频下载YT.py %clip%
return
; mGoogleTranslate:
; 	;选中文本
; 	txt = %Clipboard%
; 	; 判断如果是中文就翻译成英文
; 	Loop, parse, txt, `n, `r
; 	{
; 		S_LoopField=%A_LoopField%
; 		if (RegExMatch(S_LoopField,"[^\x00-\xff]+"))
; 		{
; 			; MsgBox, 中文
; 			ToolTip % GoogleTranslate(S_LoopField,from := "auto", to :=0409)
; 			SetTimer, ToolTipOff, -2000
; 			return
; 		}
; 		; ; 判断如果是英文就翻译成中文
; 		if (RegExMatch(S_LoopField,"^[A-Za-z]+"))
; 		{
; 			ToolTip % GoogleTranslate(S_LoopField)
; 			SetTimer, ToolTipOff, -2000
; 			return
; 		}
; 	}
; return

mdeepLTranslate:
	;选中文本
	; 判断如果是中文就翻译成英文
	; 没有API直接调用请求速度有点慢，所以改成直接访问网页端
	translator := new DeepLTranslator()
	txt = %Clipboard%

	Loop, parse, txt, `n, `r
	{
		S_LoopField=%A_LoopField%
		if (RegExMatch(S_LoopField,"[^\x00-\xff]+"))
		{
			Run,https://www.deepl.com/translator#zh/en/%S_LoopField%
			return
		}
		; ; 判断如果是英文就翻译成中文
		if (RegExMatch(S_LoopField,"^[A-Za-z]+"))
		{
			Run,https://www.deepl.com/translator#en/zh/%S_LoopField%
			return
		}
	}
return
;社交软件便捷
<Tx_OpenWithTc>:
{
	IniRead,TxFileRecv,config.ini,config,TxFileRecv
    ; global TxFileRecv := ini.config.TxFileRecv
    run,"%TCPath%" /T /O /S /L="%TxFileRecv%"
	sleep 500
	MyWinWaitActive("ahk_class TTOTAL_CMD")
    Return
}
<Ali_OpenWithTc>:
{
	IniRead,AliFileRecv,config.ini,config,AliFileRecv
    run,"%TCPath%" /T /O /S /L="%AliFileRecv%"
	sleep 500
	MyWinWaitActive("ahk_class TTOTAL_CMD")
    Return
}
<Wx_OpenWithTc>:
{
	WeixinFiles := ini.config.WeixinFiles 
	; wx_path = % "D:\My Documents\WeChat Files\你的微信目录\FileStorage\File\" . fun_GetFormatTime( "yyyy-MM" )
	run,"%TCPath%" /T /O /S /L="%WeixinFiles%".fun_GetFormatTime( "yyyy-MM" )
	sleep 500
	MyWinWaitActive("ahk_class TTOTAL_CMD")
    Return
}
<Tg_OpenWithTc>:
{
	WeixinFiles := ini.config.WeixinFiles 
	; wx_path = % "D:\My Documents\WeChat Files\你的微信目录\FileStorage\File\" . fun_GetFormatTime( "yyyy-MM" )
	run,"%TCPath%" /T /O /S /L="C:\Users\Administrator\Downloads\Telegram Desktop"
	sleep 500
	MyWinWaitActive("ahk_class TTOTAL_CMD")
    Return
}
<BoBO_F4Close>:
{
	send,!{F4}
	return
}
<BoBO_OpenLocalFliesWord>:
{
	; If ProcessExist("WINWORD.EXE")
	; {
		DocumentFile := ComObjActive("Word.Application").ActiveDocument.FullName
		Run, % "explorer /select, " DocumentFile
		return
	; }else{
	; 	MsgBox,,%_AppName%,【Microsoft Office Word】未运行！
	; 	return
	; }
}
<BoBO_OpenLocalFliesExcel>:
{
	; If ProcessExist("EXCEL.EXE")
	; {
		DocumentFile := ComObjActive("Excel.Application").ActiveWorkbook.FullName
		Run, % "explorer /select, " DocumentFile
		return
	; }else{
	; 	MsgBox,,%_AppName%,【Microsoft Office Excel】未运行！
	; 	return
	; }
}
<BoBO_OpenLocalFliesPowerPoint>:
{
	; If ProcessExist("EXCEL.EXE")
	; {
		DocumentFile := ComObjActive("PowerPoint.Application").ActivePresentation.FullName
		Run, % "explorer /select, " DocumentFile
		return
	; }else{
	; 	MsgBox,,%_AppName%,【Microsoft Office Excel】未运行！
	; 	return
	; }
}
<BoBO_OpenLocalDirCommander>:
{
	OutputText:=""
	WinGet, OutWindowID, id, A
	WinGetClass, OutClass, ahk_id %OutWindowID%
	if (OutClass in "ExploreWClass,CabinetWClass")
	{
		send ^l
		controlclick,Edit1,a
		controlsettext,Edit1,cmd,a
		send {enter}
	}
	if (OutClass ="TTOTAL_CMD")
	{
		PostMessage 1075,511,0,,ahk_class TTOTAL_CMD 
	}
	return
}
<BoBO_Test>:
global BoBO_Test=ini.BOBOPath_Config.testPath
msgbox %BoBO_Test%
return
; #默认资源管理器相关
; #源码来源 https://itenium.be/Mi-Ke/
ZipDirectory:
	currentPath := ActiveFolderPath()
	if currentPath =
		return

	selectedFiles := Explorer_GetSelected()

	; If one file selected, probably by accident?, default to zipping entire directory
	if selectedFiles
	{
		StringReplace, selectedFiles, selectedFiles, `n, `n, UseErrorLevel
		selectedFilesCount := ErrorLevel + 1
		if (selectedFilesCount = 1) {
			MsgBox, 4, Zippy, Selected one file:`n%selectedFiles%`n`nNo to zip just this file`nYes to zip the entire folder instead., 5
			IfMsgBox, Yes
				selectedFiles :=
		}
	}

	if selectedFiles
	{
		; Zip selected file(s)
		toZip =
		Loop, Parse, selectedFiles, `n
		{
			toZip .= """" A_LoopField """ "
		}
	}
	else
	{
		; Zip entire directory
		toZip := """" currentPath "\*"""
	}


	If selectedFilesCount = 1
	{
		; One filename: use that filename for the zip
		SplitPath, selectedFiles, , , , selectedFileName
		zipFileName := selectedFileName
	}
	else
	{
		; Use active directory name as name for the zip
		SplitPath, currentPath, topDirName


		; .NET: If bin/debug/release foldername, go up for full .net name
		; I assume that adding the AssemblyVersion is overkill for this script? :)
		if (topDirName = "Debug" or topDirName = "Release" or topDirName = "bin")
		{
			parentDirectory := GetParentDirectoryName(currentPath)
			SplitPath, parentDirectory, topDirName
			if (topDirName = "bin")
			{
				parentDirectory := GetParentDirectoryName(parentDirectory)
				SplitPath, parentDirectory, topDirName
			}
		}
		zipFileName := topDirName


		; If the target zip already exists?
		; Simply continuing would overwrite the existing zip with the original zip inside it (ie doubling size because 7zip doesn't see what happened)
		fullZipName = %currentPath%\%topDirName%.zip
		if FileExist(fullZipName)
		{
			MsgBox, 4, Zippy already exists?, %topDirName%.zip already exists!`n`nYes to delete it.`nNo to abort
			IfMsgBox, Yes
				FileDelete %fullZipName%
			IfMsgBox, No
				return
		}
	}

	; The actual zipping :)
	fullZipName = %currentPath%\%zipFileName%.zip

	downloadPath := ini.config.zipper
		; downloadPath := ReadMikeIni("core", "zipper", true)
	StringReplace, downloadPath, downloadPath, <fullZipName>, %fullZipName%
	StringReplace, downloadPath, downloadPath, <toZip>, %toZip%

	RunWait, %downloadPath%
	; RunWait so that we can determine file size
	; Which works - sometimes :p
	FileGetSize, zipFileSize, %fullZipName%, M

return

GetParentDirectoryName(path)
{
	return SubStr(path, 1, InStr(SubStr(path, 1, -1), "\", 0, 0) - 1)
}

^+#`::
	GV_ToggleTabKeys := !GV_ToggleTabKeys
	if(GV_ToggleTabKeys == 1)
		tooltip Tab组合键启用
	else
		tooltip Tab组合键关闭
	sleep 2000
	tooltip
return

Sub_SendTcPathExplorer:
	openPathExplorer()
return
;将Explorer中路径发送到对话框
Sub_SendExpCurPath2Diag:
{
	WinActivate ahk_class CabinetWClass
	WinGetTitle, Title, ahk_class CabinetWClass	;打开“文件夹选项”，切换到“查看”选项卡，在高级设置列表框中勾选“在标题栏显示完整路径”，单击“确定”按钮使设置生效，现在访问文件夹路径时就会在左上角的标题栏显示完整路径
	if Title=桌面
		Title=%A_Desktop%
	Send !{Tab}
	ControlFocus, Edit1, A
	send,{Backspace}
	sleep 100
	ControlSetText, Edit1, %Title%,A
	send,{enter}
return
}
;将tc中路径发送到对话框
Sub_SendTcCurPath2Diag:
{
	clipraw:=Clipboard
	Clipboard =
	PostMessage, 1075, 2029,0,, ahk_class TTOTAL_CMD
	ClipWait, 1
	srcDIR := Clipboard
	Clipboard:=clipraw

	;再发送剪贴板路径到控件
	WinActive("ahk_group GroupDiagJump")
	sleep 10
	ControlFocus, Edit1, A
	send,{Backspace}
	sleep 100
	ControlSetText, Edit1, %srcDIR%,A
	send,{enter}
return
}
;将tc中路径发送到对话框-备份
Sub_SendTcCurPath2Diag2:
{
	;将剪贴板中内容作为文件名
    B_Clip2Name := false
	B_ChangeDiagSize := true

	;先获取TC中当前路径
	clip:=Clipboard
	Clipboard =
    ;TC_Msg := 1075,cm_CopySrcPathToClip 2029
	PostMessage, 1075, 2029,0,, ahk_class TTOTAL_CMD
	ClipWait, 1
	srcDIR := Clipboard
	Clipboard:=clip

	;再发送剪贴板路径到控件
	ControlFocus, Edit1, A
	send,{Backspace}
	sleep 100
	ControlSetText, Edit1, %srcDIR%,A
	send,{enter}
	;msgbox %clip%
	if(B_Clip2Name){
		Sleep 100
		ControlSetText, Edit1, %clip%,A
	}
	;ControlSetText, Edit1, %text%,A
	if(B_ChangeDiagSize){
		;WinGetPos, xTB, yTB,lengthTB,hightTB, ahk_class Shell_TrayWnd
		;改变对话框大小，省事就直接移动到100,100的位置，然后85%屏幕大小，否则就要详细结算任务栏在上下左右的位置
		WinMove, A,,80,80, A_ScreenWidth * 0.85, A_ScreenHeight * 0.85
	}
return
}
;在TC中打开对话框的路径
Sub_SendCurDiagPath2Tc:
{
	WinGetText, CurWinAllText
	Loop, parse, CurWinAllText, `n, `r
	{
		If RegExMatch(A_LoopField, "^地址: "){
			curDiagPath := SubStr(A_LoopField,4)
			break
		}
	}
	{
	DiagPath := % curDiagPath
	WinActivate ahk_class TTOTAL_CMD
	PostMessage 1075, 3001, 0, , AHK_CLASS TTOTAL_CMD
	ControlSetText, Edit1, cd %DiagPath%, ahk_class TTOTAL_CMD
	Sleep 400
	ControlSend, Edit1, {Enter}, ahk_class TTOTAL_CMD
	}
return
}
;在系统资管中打开对话框的路径
Sub_SendCurDiagPath2Exp:
{
	WinGetText, CurWinAllText
	Loop, parse, CurWinAllText, `n, `r
	{
		If RegExMatch(A_LoopField, "^地址: "){
			curDiagPath := SubStr(A_LoopField,4)
			break
		}
	}
	{
	DiagPath := % curDiagPath
	run explorer.exe %DiagPath%
	}
return
}

Sub_SendTcPathCurDiag:
	Dlg_HWnd := WinExist("ahk_group GroupDiagJump")
	if Dlg_HWnd 
			;IfWinExist ahk_group GroupDiagOpenAndSave
	{
		WinGetTitle, Dlg_Title, ahk_id %Dlg_HWnd%
		If RegExMatch(Dlg_Title, "Save|Save As|另存为|保存|图形另存为|保存副本"){
					;msgbox "这是保存对话框"
		orgClip:=clipboardAll
		Clipboard =
					;PostMessage, TC_Msg, CM_CopyFullNamesToClip,0,, ahk_class TTOTAL_CMD
		Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`CM_CopyFullNamesToClip`)"
					; TcSendPos(CM_CopyFullNamesToClip)
		ClipWait, 1
		selFiles := Clipboard
		Clipboard:=orgClip
		selFilesArray := StrSplit(selFiles, "`n","`r")
		if selFilesArray.length() > 1 {
			selFiles:=selFilesArray[1]
						; eztip("对话框是保存类型，只认第一个文件",1)
		}
		StringGetPos OutputVar, selFiles,`\,R1
		StringMid, filePath, selFiles,1, OutputVar+1
		StringMid, fileName, selFiles,OutputVar+2,StrLen(selFiles)-OutputVar

		IfWinNotActive, %Dlg_Title% ahk_id %Dlg_HWnd%, , WinActivate, %Dlg_Title% ahk_id %Dlg_HWnd%
		WinWaitActive, %Dlg_Title% ahk_id %Dlg_HWnd%
		if !ErrorLevel
		{
			ControlGetText, orgFileName,Edit1
			ControlFocus, Edit1,
			sleep 200
			Send,{Backspace}
			sleep 300
			setKeyDelay, 10,10
			ControlSetText, Edit1, %filePath% 
			sleep 900
			send,{enter}
			sleep 500
			if StrLen(fileName) > 0 {
				ControlSetText, Edit1, %fileName% 
			}
			else{
				ControlSetText, Edit1, %orgFileName% 
			}
		}
		}
		else {
					; msgbox "打开对话框"
					orgClip:=clipboardAll
					Clipboard =
					;PostMessage, TC_Msg, CM_CopyFullNamesToClip,0,, ahk_class TTOTAL_CMD
					; TcSendPos(CM_CopyFullNamesToClip)
					Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`CM_CopyFullNamesToClip`)"
					ClipWait, 1
					selFiles := Clipboard
					Clipboard:=orgClip
					selFilesArray := StrSplit(selFiles, "`n","`r")
					quote:=(selFilesArray.length() > 1) ? """" : ""
					selFiles=
					Loop % selFilesArray.MaxIndex()
					{
						this_file := selFilesArray[A_Index]
						selFiles=%selFiles% %quote%%this_file%%quote%
					}
					IfWinNotActive, %Dlg_Title% ahk_id %Dlg_HWnd%, , WinActivate, %Dlg_Title% ahk_id %Dlg_HWnd%
					WinWaitActive, %Dlg_Title% ahk_id %Dlg_HWnd%
					if !ErrorLevel
					{
						sleep 300
						setKeyDelay, 10,10
						ControlSetText, Edit1, %selFiles%
						send, {Enter}
					}
				}
				; reload
	}
return

;在Explorer打开
<opemLocalDirExe>:
{
	WinGet, pPath, Processpath, A
	SplitPath,pPath,pName,pDir,,pNameNoExt
	Run % "explorer.exe /select," pPath
	sleep,200
	send,{esc}
	return
}
<BoBO_HuntAndPeck>:
{
    run %A_ScriptDir%\custom\apps\HuntAndPeck\hap.exe /hint
	return	
}

Sub_MaxRestore:
	WinGet, Status_minmax ,MinMax,A
	If (Status_minmax=1){
		WinRestore A
	}
	else{
		WinMaximize A
	}
return

Sub_MaxAllRestore:
    ifWinExist, ahk_id %FullscreenWindow%
    {
        if PMenu                    ; Restore the menu.
            DllCall("SetMenu", "UInt", FullscreenWindow, "UInt", PMenu)
        WinSet, Style, +0xC40000    ; Restore WS_CAPTION|WS_SIZEBOX.
        WinMove,,, PX, PY, PW, PH   ; Restore position and size.
        FullscreenWindow =
        return
    }

    WinGet, Style, Style, A
    if (Style & 0xC40000) != 0xC40000 ; WS_CAPTION|WS_SIZEBOX
        return

    FullscreenWindow := WinExist("A")
    
    WinGetPos, PX, PY, PW, PH
    
    ; Remove WS_CAPTION|WS_SIZEBOX.
    WinSet, Style, -0xC40000
    
    PMenu := DllCall("GetMenu", "UInt", FullscreenWindow)
    ; Remove the window's menu.
    if PMenu
        DllCall("SetMenu", "UInt", FullscreenWindow, "UInt", 0)
    
    ; Get the area of whichever monitor the window is on.
    SysGet, m, Monitor, % ClosestMonitorTo(PX + PW//2, PY + PH//2)
    
    ; Size the window to fill the entire screen.
    WinMove,,, mLeft, mTop, mRight-mLeft, mBottom-mTop
return

Sub_MaxAllWindows:
	WinGet, Window_List, List ; Gather a list of running programs
	Loop, %Window_List%
	{
		wid := Window_List%A_Index%
		WinGetTitle, wid_Title, ahk_id %wid%
		WinGet, Style, Style, ahk_id %wid%
		;(WS_CAPTION 0xC00000| WS_SYSMENU 0x80000| WS_MAXIMIZEBOX 0x10000) | WS_SIZEBOX 0x40000
		If (!(Style & 0xC90000) or !(Style & 0x40000) or (Style & WS_DISABLED) or !(wid_Title)) ; skip unimportant windows ; ! wid_Title or
			Continue
		;MsgBox, % (Style & 0x40000)
		WinGet, es, ExStyle, ahk_id %wid%
		Parent := Decimal_to_Hex( DllCall( "GetParent", "uint", wid ) )
		WinGet, Style_parent, Style, ahk_id %Parent%
		Owner := Decimal_to_Hex( DllCall( "GetWindow", "uint", wid , "uint", "4" ) ) ; GW_OWNER = 4
		WinGet, Style_Owner, Style, ahk_id %Owner%

		If (((es & WS_EX_TOOLWINDOW)  and !(Parent)) ; filters out program manager, etc
			or ( !(es & WS_EX_APPWINDOW)
			and (((Parent) and ((Style_parent & WS_DISABLED) =0)) ; These 2 lines filter out windows that have a parent or owner window that is NOT disabled -
				or ((Owner) and ((Style_Owner & WS_DISABLED) =0))))) ; NOTE - some windows result in blank value so must test for zero instead of using NOT operator!
			continue
		WinGet, Status_minmax ,MinMax,ahk_id %wid%
		If (Status_minmax!=1) {
			WinMaximize,ahk_id %wid%
		}
		;MsgBox, 4, , Visiting All Windows`n%a_index% of %Window_List%`n`n%wid_Title%`nContinue?
		;IfMsgBox, NO, break
	}
return

<TaskSwch>:
{
	Run, %A_ScriptDir%\custom\apps\TaskSwch\TaskSwch.exe /t
	return
}

; 窗口居中
<BoBO_CenterWindow>:
	{
		WinGetActiveTitle, var_title
		CenterWindow(var_title)
		return
	}
<BoBO_TaskSwch>:
{
	IniRead, TaskMuEx,config.ini, config, TaskMuEx, 1
	if TaskMuEx = 1
	{
			; run %A_ScriptDir%\custom\apps\TaskSwch\TaskMuEx.exe /n
		run %A_ScriptDir%\custom\apps\TaskSwch\TaskSwch.exe /t
		return
		}
		else
		{
			return
		}
	return
}
	showTim:
	{
		Process, Wait, TIM.exe, 1
		NewPID := ErrorLevel  ; 由于 ErrorLevel 会经常发生改变, 所以要立即保存这个值.
		if not NewPID
		{
			; 如果没有Tim或没运行保持原有
			send,#{q}
			return
		}
		if NewPID
		{
			if TIM_Swith_var=2 ;
			TIM_Swith_var=0
			TIM_Swith_var+=1
			TIM_var=0
			if (TIM_Swith_var=1 )
			{    
				TrayIcon_Button("TIM.exe", "L")
				return
			}
			if (TIM_Swith_var=2)
			{
				send,{Esc}
				return
			}
			return
			}
	return
	}
ToolTipOff:
	ToolTip
Return


Run_MouseInc:
{
	Process, Wait, MouseInc.exe, 1
	NewPID := ErrorLevel  ; 由于 ErrorLevel 会经常发生改变, 所以要立即保存这个值.
	if not NewPID
	{
		; 如果进程没有ShortCutHelper则运行
		Run,%A_ScriptDir%\custom\apps\MouseInc\MouseInc.exe
		return
	}
	if NewPID
	{
		sendinput,!s
		return
	}
}
Run_RunZ:
{
	Run,%A_ScriptDir%\runz\RunZ.ahk
	return
}

Run_ShortCutHelperExe:
{
	Process, Wait, XiaoChao.exe, 1
	NewPID := ErrorLevel  ; 由于 ErrorLevel 会经常发生改变, 所以要立即保存这个值.
	if not NewPID
	{
		; 如果进程没有ShortCutHelper则运行
		Run,%A_ScriptDir%\custom\apps\ShortCutHelper\XiaoChao.exe
		return
	}
	if NewPID
	{
		sendinput,^!+{l}
		return
	}
	return
}

Run_Espanso:
{
	Run,%A_ScriptDir%\custom\apps\espanso\espansod.exe launcher
	return
}

Run_ClsClose:
{
	Run,%A_ScriptDir%\custom\apps\TaskSwch\ClsClose.exe
	return
}

Run_Explore:
{
	Run,explorer.exe
	return
}
Run_ExploreCls:
{
	Run,%A_ScriptDir%\custom\apps\TaskSwch\ClsFoldr.EXE
	return
}
Run_WindowsActivation:
{
	Run,%A_ScriptDir%\\KMS_VL_ALL_AIO.cmd
	return
}
PopSelWork:
{
	PopSel("work.lst")
	return
}
PopSelSystem:
{
	PopSel("System.lst")
	return
}
AscSend(str){
	SetFormat, Integer, H
	for k,v in StrSplit(str)
	out.="{U+ " Ord(v) "}"
	Sendinput % out
}
MoveWindows:
	CoordMode, Mouse  ; Switch to screen/absolute coordinates.
	MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
	WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
	WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 
	if EWD_WinState = 0  ; Only if the window isn't maximized 
	SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
return



Alert1:
	Value := WindowList.Pop()
	if (Value=WinExist("A"))
	{
		WindowList.push(WinExist("A"))
	}
	else
	{
		if (value!="")
			WindowList.push(Value)
		WindowList.push(WinExist("A"))
	}
return

SwitchWindows:
	Value:=WindowList[WindowList.Length()-1]
	IfWinNotExist,ahk_id  %Value%
	{
		WindowList.RemoveAt(WindowList.Length()-1)
	}
	WinActivate,ahk_id  %Value%
return




; 一键转化文本成小写
; Ctrl+Shift+L -> Copy texts to lower
; ---------------------------------------------------------
^+l::
{
    Clipboard = %clipboard% 
    Send ^{c}
    ClipWait, 2
    StringLower, Clipboard , Clipboard
    Return
}
; 一键转化文本成大写
; Ctrl+Shift+U -> Copy texts to upper
; ---------------------------------------------------------
^+!u::
{
    Clipboard = %clipboard% 
    Send ^{c}
    ClipWait, 2
    StringUpper, Clipboard , Clipboard
    Return
}


; ffmpeg 格式转换
; Ctrl+Shift+U -> Copy texts to upper
; ---------------------------------------------------------
<FFmpeg_Video_img>:
	Clipboard:=
	Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`cm_CopyNetNamesToClip`)"
    sleep,500 ;必须延迟 否则获取不到路径
	ffmpeg_Video_img(Clipboard)
return

<ffmpeg_Video_gif>:
	Clipboard:=
	Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`cm_CopyNetNamesToClip`)"
    sleep,500 ;必须延迟 否则获取不到路径
	ffmpeg_Video_gif(Clipboard)
return
<ffmpeg_Video_tsmp4>:
	Clipboard:=
	Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`cm_CopyNetNamesToClip`)"
    sleep,500 ;必须延迟 否则获取不到路径
	ffmpeg_Video_tsmp4(Clipboard)
return
<ffmpeg_Video_mp4ac>:
	Clipboard:=
	Run, "%TCDirPath%\Tools\TCFS2\TCFS2.exe" /ef "tem(`cm_CopyNetNamesToClip`)"
    sleep,500 ;必须延迟 否则获取不到路径
	ffmpeg_Video_mp4ac(Clipboard)
return


; FSCapture截图
<FSCapture_激活窗口>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Alt+PrtSc"
return
<FSCapture_窗口或对象>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Shift+PrtSc"
return
<FSCapture_矩形区域>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Ctrl+PrtSc"
return
<FSCapture_手绘区域>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Ctrl+Shift+PrtSc"
return
<FSCapture_整个屏幕>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "PrtSc"
return
<FSCapture_滚动窗口>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Ctrl+Alt+PrtSc"
return
<FSCapture_固定大小区域>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Ctrl+Alt+Shift+PrtSc"
return
<FSCapture_系统自带截图>:
Run,%A_ScriptDir%\tools\TotalCMD\Tools\FSCapture\FSCLoader.exe "Ctrl+Alt+Shift+PrtSc"
send,#+{s}
return

;打开剪贴板中多个链接
OpenClipURLS:
	Loop, parse, clipboard, `n, `r  ; 在 `r 之前指定 `n, 这样可以同时支持对 Windows 和 Unix 文件的解析.
	{
		cu := A_LoopField
		if(RegExMatch(A_LoopField,"^http")){
			sleep 200
			run, nircmd shexec open "%A_LoopField%"
		}
	}
return




; F12::
; msgbox
; 	btt("我是提示",200,300,2,"Style6")							; btt2
; return
